From 6a2996251ceaf97ea30d74f0161ee08d29602ebe Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 29 May 2024 18:06:47 -0500 Subject: [PATCH] fixes a bug in OSC9;9 execution (#12994) # Description This fixes a bug in the `OSC 9;9` functionality where the path wasn't being constructed properly and therefore wasn't getting set right for things like "Duplicate Tab" in Windows Terminal. Thanks to @Araxeus for finding it. Related to https://github.com/nushell/nushell/issues/10166 # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-cli/src/repl.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nu-cli/src/repl.rs b/crates/nu-cli/src/repl.rs index 29c2f62734..d9aef32bbb 100644 --- a/crates/nu-cli/src/repl.rs +++ b/crates/nu-cli/src/repl.rs @@ -1110,9 +1110,9 @@ fn run_shell_integration_osc9_9(engine_state: &EngineState, stack: &mut Stack, u let start_time = Instant::now(); // Otherwise, communicate the path as OSC 9;9 from ConEmu (often used for spawning new tabs in the same dir) + // This is helpful in Windows Terminal with Duplicate Tab run_ansi_sequence(&format!( - "\x1b]9;9;{}{}\x1b\\", - if path.starts_with('/') { "" } else { "/" }, + "\x1b]9;9;{}\x1b\\", percent_encoding::utf8_percent_encode(&path, percent_encoding::CONTROLS) ));