Skip to content

fix(picker): clear screen on exit in inline mode - #2626

Merged
max-sixty merged 1 commit into
mainfrom
fix-picker-inline-clear
May 7, 2026
Merged

max-sixty merged 1 commit into
mainfrom
fix-picker-inline-clear

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

The interactive picker (wt switch) sometimes leaves its frame on screen after Enter — observed on at least one Linux setup, not on macOS. Root cause is in skim/tuikit's screen handling, not in our code; this patch works around it by toggling a skim option.

Why

The picker uses height: "90%", so tuikit never enters the alternate screen — smcup is never sent. But its pause() still emits rmcup whenever disable_alternate_screen is false (the default). Unmatched rmcup:

  • macOS terminals (iTerm, default Terminal.app): no-op, terminal stays clean by other means
  • Some Linux terminals: no-op too, but no explicit erase runs either, so the picker frame remains visible

skim plumbs disable_alternate_screen = no_clear_start (skim/src/lib.rs Skim::run_with). Setting no_clear_start: true forces pause() down the cursor_goto + erase_down branch, which actually erases the rows skim drew on.

Side effect: clear_on_start = false. Harmless here — skim immediately overdraws the rows it allocates.

Risk

Low. The change is more deterministic than the default — explicit erase via cursor positioning is more portable than relying on terminal-specific behavior of unmatched rmcup. Easy to revert if it surprises someone.

Caveat: the affected user can't reliably reproduce on macOS, so this is a plausible fix shipped to gather telemetry from real Linux terminals. The mechanism is sound; verification will come from users.

Test plan

  • cargo run -- hook pre-merge --yes (3499 tests pass)
  • Manual: post-load Enter on macOS — significantly cleaner clearing (2 stragglers vs full picker corruption)
  • User to verify on the affected Linux box after release

The picker uses `height: "90%"`, so tuikit never enters the alternate
screen. But its `pause()` still emits `rmcup` (when
`disable_alternate_screen` is false) — and unmatched `rmcup` is a
no-op on most macOS terminals but leaves the picker frame on screen
on some Linux setups, since no explicit erase runs.

Set `no_clear_start: true` on SkimOptions, which skim plumbs through
to `disable_alternate_screen=true` (`skim/src/lib.rs` `Skim::run_with`).
That routes `pause()` down the `cursor_goto + erase_down` branch,
which actually erases the rows skim drew. The other side effect,
`clear_on_start=false`, is harmless: skim immediately overdraws the
rows it allocates.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit a93545e into main May 7, 2026
27 checks passed
@max-sixty
max-sixty deleted the fix-picker-inline-clear branch May 7, 2026 02:34
@max-sixty max-sixty mentioned this pull request May 10, 2026
3 tasks done
max-sixty added a commit that referenced this pull request May 10, 2026
Bump worktrunk to **0.49.0** — minor bump (semver-checks reports a
breaking change in `GitError::UncommittedChanges`, which gained a
`dirty_files: Vec<String>` field).

## Highlights

**Improved**
- New `codename(n)` template filter — deterministic friendly worktree
names from a ~1.26M-combo pool (`{{ branch | codename(2) }}` →
`malleable-opah`).
[#2641](#2641), thanks
@endigma
- Picker preview disk cache for Log / BranchDiff / UpstreamDiff, with
background refresh for stale Log decorations.
[#2628](#2628),
[#2646](#2646)
- Picker shares one `default_branch_sha` lookup across BranchDiff items
instead of forking N rev-parse subprocesses.
[#2658](#2658)
- "X has uncommitted changes" errors now list the dirty files inline.
[#2653](#2653)

**Fixed**
- `wt switch` integrates with `cd` aliases like zoxide (uses `builtin
cd`). [#2644](#2644), thanks
@xkumiyu for reporting
- Empty hook tables no longer panic during `wt switch --create`.
[#2635](#2635), thanks @topit
for reporting
- `Repository::current_worktree()` and five sibling helpers no longer
silently leak the process CWD when called via `Repository::at(p)`.
[#2652](#2652)
- `WorkingTree::is_linked` tolerates non-git CWDs (e.g. Nix sandbox).
[#2625](#2625), thanks
@DArtagan for reporting
- Picker no longer overlays `collect` warnings on the active TUI; clears
its frame on exit in inline mode.
[#2627](#2627),
[#2626](#2626)
- Failed `git log` no longer poisons the picker's preview disk cache.
[#2651](#2651)
- `wt step prune` says "removing branch" for branch-only candidates.
[#2619](#2619)
- Claude Code Windows integration uses a `wt.sh` wrapper to avoid
colliding with Windows Terminal's `wt.exe`.
[#1754](#1754), thanks
@lucaspimentel

**Documentation**
- cmux workspace integration recipe.
[#1907](#1907), thanks
@alvistar

See
[CHANGELOG.md](https://github.com/max-sixty/worktrunk/blob/release/CHANGELOG.md)
for the full list including internal CI / test-isolation changes.

## Test plan

- [x] `cargo run -- hook pre-merge --yes` (tests + lints clean)
- [x] `cargo semver-checks check-release -p worktrunk` (one breaking
change confirmed → minor bump)
- [x] CHANGELOG entries verified by subagent against actual diffs

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants