diff --git a/src-tauri/src/ssh/session.rs b/src-tauri/src/ssh/session.rs index c36be93..7a0b965 100644 --- a/src-tauri/src/ssh/session.rs +++ b/src-tauri/src/ssh/session.rs @@ -160,15 +160,17 @@ impl SshService { // Inject OSC 7 CWD reporting hook into the user's shell. // This enables SFTP CWD following on all platforms (Linux, macOS, FreeBSD). // Sent via the PTY channel so it configures the interactive shell. + // Wrapped in stty -echo/echo so the command is invisible to the user, + // then clear the line with \r and overwrite with spaces. { let osc7_hook = concat!( - // Detect shell and inject the appropriate hook silently + " stty -echo; ", r#"if [ -n "$ZSH_VERSION" ]; then "#, r#"precmd() { printf '\033]7;file://%s%s\033\\' "$HOST" "$PWD"; }; "#, r#"elif [ -n "$BASH_VERSION" ]; then "#, r#"PROMPT_COMMAND='printf "\033]7;file://%s%s\033\\\\" "$HOSTNAME" "$PWD"'; "#, - r#"fi"#, - "\n" + r#"fi; "#, + "stty echo; clear\n" ); let h = handle.lock().await; let _ = h.data(channel_id, CryptoVec::from_slice(osc7_hook.as_bytes())).await;