From a4111612873e91c8045a3fa2f1b5ab25d9116895 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 15:00:46 +0800 Subject: [PATCH] fix(terminal): keep the \\wsl$ completion route on this machine's panes A WSL pane owned by a remote host reaches its distro through that host, not through a local \\wsl$ share -- a same-named local distro would list the wrong machine's files. Gate wsl_share_cwd on host locality, so a remote host's WSL pane falls back to handing Tab to the shell. --- src/terminal/view.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/terminal/view.rs b/src/terminal/view.rs index ce1d9d7f..280a090a 100644 --- a/src/terminal/view.rs +++ b/src/terminal/view.rs @@ -3642,7 +3642,14 @@ impl TerminalView { /// filesystem is a WSL distro's: the local wsl.exe pane (tagged by its /// remote context) and the WSL-workspace pane (tagged by its workspace /// target) both report a POSIX cwd this process cannot read natively. + /// + /// Only for panes on this machine: a WSL pane owned by a remote host + /// reaches its distro through that host, not through a `\\wsl$` share + /// here — a same-named local distro would list the wrong machine. fn wsl_share_cwd(&self) -> Option { + if !self.host_id.is_local() { + return None; + } let distro = match self.terminal.remote_context() { Some(remote) => (remote.kind == crate::daemon::protocol::RemoteKind::Wsl) .then_some(remote.target)?,