Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix(select): screen artifacts left after interactive picker exits (#1028)

David Beesley3bd61c96e801
diff --git a/src/commands/select/mod.rs b/src/commands/select/mod.rs
index 7a52fbbd4..0406b2853 100644
--- a/src/commands/select/mod.rs
+++ b/src/commands/select/mod.rs
@@ -160,6 +160,10 @@ pub fn handle_select(branches: bool, remotes: bool, config: &UserConfig) -> anyh
// Configure skim options with Rust-based preview and mode switching keybindings
let options = SkimOptionsBuilder::default()
.height("90%".to_string())
+ // Workaround for skim-tuikit bug: partial-height mode skips smcup but
+ // cleanup still sends rmcup, leaving artifacts. no_clear_start forces
+ // cursor_goto + erase_down cleanup instead. See skim-rs/skim#880.
+ .no_clear_start(true)
.layout("reverse".to_string())
.header_lines(1) // Make first line (header) non-selectable
.multi(false)
diff --git a/tests/integration_tests/switch_picker.rs b/tests/integration_tests/switch_picker.rs
index 291267e40..8c8cf4b22 100644
--- a/tests/integration_tests/switch_picker.rs
+++ b/tests/integration_tests/switch_picker.rs
@@ -787,14 +787,13 @@ branches = true
);
let env_vars = repo.test_env_vars();
- // Wait for orphan-branch to appear before sending Escape
- // Under CI load, the branch list may take time to render fully
- let result = exec_in_pty_with_input_expectations(
+ // Capture screen BEFORE sending Escape. Screen must stabilize with orphan-branch visible.
+ let result = exec_in_pty_capture_before_abort(
wt_bin().to_str().unwrap(),
&["switch"], // No --branches flag - config should enable it
repo.root_path(),
&env_vars,
- &[("\x1b", Some("│orphan-branch"))], // Wait for branch to appear (│ = border drawn)
+ &[("", Some("│orphan-branch"))], // Wait for orphan-branch to appear before abort
);
assert_valid_abort_exit_code(result.exit_code);