From 60f910d06fb1c4e5438305ce78b471fc050aefba Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sun, 9 Aug 2026 08:51:37 +0700 Subject: [PATCH] fix(ssh): stop the disconnect strip naming a chord it cannot know MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two things on the strip were written as constants when neither is one. The chord was the literal "⌘⇧R". That spelling is macOS's rendering of one default binding: on Windows and Linux it names a modifier the keyboard does not have, and on every platform it kept claiming ⌘⇧R after the user had rebound Reconnect to something else. Every other in-window hint — the home screen's shortcut list, the palette — reads the binding back out of the keymap with `key_hint`, which also returns None when the action carries no binding at all. Do that here and say nothing when there is nothing true to say. The reason ssh gave is capped at 360px and truncated. It runs past that more often than not ("Permission denied (publickey,keyboard-interactive)" alone is wider), and by the time the strip is up the pane's own output has scrolled away, so the elided sentence was the only account left of why the connection ended. Give it the tooltip that carries the rest. --- src/ui/forwards.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ui/forwards.rs b/src/ui/forwards.rs index 1f9d1e5a..9ff8432b 100644 --- a/src/ui/forwards.rs +++ b/src/ui/forwards.rs @@ -73,13 +73,30 @@ impl Tty7App { }), ) .children(reason.map(|reason| { + // The reason is whatever ssh said, and it runs past 360px more + // often than not — a truncated "…" was the only account of a + // rejected key the pane had left, its own output having + // scrolled away. Hovering gives the whole sentence back. + let full = reason.clone(); div() + .id("ssh-strip-reason") .max_w(px(360.)) .truncate() .text_color(theme.danger) + .tooltip(move |window, cx| { + gpui_component::tooltip::Tooltip::new(full.clone()).build(window, cx) + }) .child(reason) })) - .child(div().child("· ⌘⇧R")) + // The chord was spelled "⌘⇧R" here. That is one platform's + // rendering of one default: off macOS it names a modifier the + // keyboard does not have, and either way it kept saying ⌘⇧R after + // the user had rebound Reconnect to something else. Ask the keymap, + // and say nothing at all when the action carries no binding. + .children( + crate::ui::home::key_hint("RestartSshSession", cx) + .map(|keys| div().child(format!("· {keys}"))), + ) .child( Button::new("ssh-reconnect") .label(crate::ui::i18n::t(crate::ui::i18n::L10nKey::Reconnect))