Skip to content

fix(terminal): send the OSC 7 cwd integration to zsh shells - #382

Merged
GOODBOY008 merged 3 commits into
GOODBOY008:mainfrom
sunxiaobin89:fix/zsh-cwd-follow
Dec 2, 2026
Merged

GOODBOY008 merged 3 commits into
GOODBOY008:mainfrom
sunxiaobin89:fix/zsh-cwd-follow

Conversation

@sunxiaobin89

Copy link
Copy Markdown
Contributor

Summary

Fixes #376 (follow-up to #70, which implemented the Bash path only). The OSC 7 working-directory integration was only installed when the version probe found BASH_VERSION, so zsh login shells — the macOS default — never reported their cwd and the file browser's follow mode never moved.

  • Probe ZSH_VERSION in the same round-trip as BASH_VERSION.
  • Add RemoteShell::{Bash, Zsh} detection (Bash wins if both are somehow set).
  • For zsh, install the hook with precmd_functions+=(__rshell_report_cwd), which works independently of the prompt theme.
  • Disable PTY ECHO for zsh just like Bash, since the integration prints the prompt itself.

Test plan

  • cargo test --lib shell_integration — 9 passed (includes new zsh detection + command tests).
  • Manually: connect to a macOS/zsh host, cd /tmp with follow enabled in the file browser. Not run in this environment.

The version probe only looked for BASH_VERSION, so hosts whose login shell is zsh never received the working-directory hook and the file browser's follow mode stayed put. Probe ZSH_VERSION too, install the hook via precmd_functions, and disable PTY ECHO for zsh like Bash.

Refs GOODBOY008#70, Fixes GOODBOY008#376
@GOODBOY008
GOODBOY008 merged commit 637fa4e into GOODBOY008:main Dec 2, 2026
13 of 16 checks passed
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.

Terminal working-directory sync does not work when the remote shell is zsh

2 participants