Skip to content

fix: shell quoting edge cases, TUI scrolling, and worktree/graduate fixes - #146

Open
Scrates1 wants to merge 1 commit into
tobi:mainfrom
Scrates1:fix/shell-quoting-and-tui-edge-cases
Open

Scrates1 wants to merge 1 commit into
tobi:mainfrom
Scrates1:fix/shell-quoting-and-tui-edge-cases

Conversation

@Scrates1

@Scrates1 Scrates1 commented Dec 2, 2026

Copy link
Copy Markdown

Hey! Love using try. While testing a few edge cases (paths with spaces/quotes, larger directory lists, and graduating worktrees), I ran into a handful of small bugs and put together fixes + regression tests for them.

What's changed

Shell quoting & path handling

  • Quote the clone URI with q(uri) in script_clone (matching script_clone_pr) so URIs with single quotes don't break the emitted script.
  • Pass paths as positional args to sh -c '...' _ in script_worktree to avoid nested single-quote syntax errors when repo or TRY_PATH directories contain spaces or apostrophes.
  • Properly escape paths in init_snippet (bash/zsh/fish/pwsh) and expand relative/~ paths in cmd_init! / cmd_install!.

TUI & command edge cases

  • Remove .limit(max_results) from get_tries so users with more than one screen of directories can scroll through the full list, and adjust scroll offset for the blank separator line so the selected Create new row isn't clipped off-screen.
  • Look up marked items from load_all_tries in confirm_batch_delete (preserving mark order across filter changes) and cap the displayed list in render_delete_dialog so the Type YES to confirm: prompt stays visible.
  • Fix a few Ctrl-G (Graduate) edge cases: pass -C to git worktree move so it works from any CWD, prevent re-graduating an already-graduated symlink, and check for an empty destination before File.expand_path.
  • Walk up parent directories in try . <name> to detect .git from subdirectories (while ensuring nonexistent paths don't walk up), and narrow the dot-prefix check so searching .env opens the selector instead of creating a directory.

Test fixes

  • Run type/whence checks in test_36_shell_eval.sh with LC_ALL=C so it passes on non-English locales.
  • Update the rename emoji check in test_21_tmux_rename.sh to match ✏️.

Verification

  • Kept all changes Spinel-friendly (no FileUtils, eval, or block gsub), though I don't have spinel installed locally to run rake spec_spinel.
  • Tested on MRI Ruby 3.2.3:
    • rake lint — syntax OK
    • rake unit — 134 runs, 281 assertions, 0 failures
    • rake spec — 411/411 passed
    • spec/tests/tmux/run.sh ./try.rb — 37/37 passed
    • Verified init and worktree scripts with spaces & single quotes end-to-end in bash and fish.

@Scrates1
Scrates1 force-pushed the fix/shell-quoting-and-tui-edge-cases branch from 1fc248c to 58919a6 Compare December 2, 2026 06:23

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant