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.
This commit is contained in:
l0ng-ai
2026-08-08 15:00:46 +08:00
parent 5e8d75689f
commit a411161287
+7
View File
@@ -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<std::path::PathBuf> {
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)?,