fix(ssh): stop the disconnect strip naming a chord it cannot know

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.
This commit is contained in:
l0ng-ai
2026-08-09 08:51:37 +07:00
parent 8d52948bd2
commit 60f910d06f
+18 -1
View File
@@ -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))