the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
fix: show configured prefix on welcome screen (#4747)
JJ Liebigdbdb8dc8f5bc
diff --git a/src/client/shell/overlays.rs b/src/client/shell/overlays.rsindex 7116713b6..f26cc6e4e 100644--- a/src/client/shell/overlays.rs+++ b/src/client/shell/overlays.rs@@ -56,7 +56,7 @@ pub(crate) fn render_client_overlay(}}match o {- ClientShellOverlay::Onboarding => render_onboarding_overlay(b, p),+ ClientShellOverlay::Onboarding => render_onboarding_overlay(b, k, p),ClientShellOverlay::ProductAnnouncement(v) => render_product_announcement_overlay(b, v, p),ClientShellOverlay::ReleaseNotes(v) => {render_release_notes_overlay(b, v, &s.update_install_command, p)@@ -262,7 +262,11 @@ fn panel(Some(Rect::new(a.x + 1, a.y + 1, a.width - 2, a.height - 2))}fn popup(a: Rect, w: u16, h: u16) -> Option<Rect> {- let w = w.min(a.width.saturating_sub(4));+ popup_with_width_cap(a, w, h, 4)+}++fn popup_with_width_cap(a: Rect, w: u16, h: u16, width_cap: u16) -> Option<Rect> {+ let w = w.min(a.width.saturating_sub(width_cap));let h = h.min(a.height.saturating_sub(2));if w < 4 || h < 4 {return None;@@ -533,8 +537,18 @@ fn render_product_announcement_overlay(})}-fn render_onboarding_overlay(b: &mut Buffer, p: &Palette) -> Option<OverlayRender> {- let outer = popup(b.area, 64, 16)?;+fn render_onboarding_overlay(+ b: &mut Buffer,+ k: &LiveKeybindConfig,+ p: &Palette,+) -> Option<OverlayRender> {+ let prefix = k.primary_prefix_label();+ let hint_width = display_width(" ")+ + display_width(&prefix)+ + display_width(crate::ui::ONBOARDING_PREFIX_SUFFIX)+ + display_width(crate::ui::ONBOARDING_HELP_LABEL)+ + display_width(crate::ui::ONBOARDING_HELP_SUFFIX);+ let outer = popup_with_width_cap(b.area, (hint_width + 5).max(64), 16, 3)?;let inner = panel(b, outer, p.accent, p.panel_bg)?;if inner.height < 11 {return Some(OverlayRender {@@ -584,7 +598,7 @@ fn render_onboarding_overlay(b: &mut Buffer, p: &Palette) -> Option<OverlayRendelet mut key_x = content.x;for (value, style) in [(" ", base),- (crate::ui::ONBOARDING_PREFIX_LABEL, accent),+ (prefix.as_str(), accent),(crate::ui::ONBOARDING_PREFIX_SUFFIX, text),(crate::ui::ONBOARDING_HELP_LABEL, accent),(crate::ui::ONBOARDING_HELP_SUFFIX, text),diff --git a/src/client/shell/tests/startup_overlays.rs b/src/client/shell/tests/startup_overlays.rsindex 7107aa713..bddcde10c 100644--- a/src/client/shell/tests/startup_overlays.rs+++ b/src/client/shell/tests/startup_overlays.rs@@ -349,6 +349,26 @@ fn startup_onboarding_is_client_rendered_and_modal() {assert!(popup_paste.requests.is_empty());}+#[test]+fn startup_onboarding_shows_configured_prefix() {+ let mut config = Config::default();+ config.keys.prefix = crate::config::BindingConfig::one("ctrl+shift+b");+ let config = ClientShellConfig::from_config(&config).with_startup_onboarding(true);+ let mut state = ClientShellState::new(config);+ state.set_snapshot(Box::new(snapshot()));+ state.set_pane_surface(surface());++ let frame = state.compose(70, 20).expect("onboarding frame");+ let text = frame+ .cells+ .iter()+ .map(|cell| cell.symbol.as_str())+ .collect::<String>();+ assert!(text.contains("ctrl+shift+b enters prefix mode"));+ assert!(text.contains("shows keybinds and settings"));+ assert!(!text.contains("ctrl+b enters prefix mode"));+}+#[test]fn onboarding_completion_persists_and_opens_endpoint_integrations() {let path = std::env::temp_dir().join(format!(diff --git a/src/ui.rs b/src/ui.rsindex 141e09d33..8fb7c7d30 100644--- a/src/ui.rs+++ b/src/ui.rs@@ -12,8 +12,8 @@ mod widgets;pub(crate) use self::onboarding::{onboarding_welcome_continue_rect, ONBOARDING_DESCRIPTION, ONBOARDING_HELP_LABEL,- ONBOARDING_HELP_SUFFIX, ONBOARDING_NEXT, ONBOARDING_PREFIX_LABEL, ONBOARDING_PREFIX_SUFFIX,- ONBOARDING_SUBTITLE, ONBOARDING_TITLE,+ ONBOARDING_HELP_SUFFIX, ONBOARDING_NEXT, ONBOARDING_PREFIX_SUFFIX, ONBOARDING_SUBTITLE,+ ONBOARDING_TITLE,};#[cfg(all(test, unix))]pub(crate) use self::panes::popup_pane_rects;diff --git a/src/ui/onboarding.rs b/src/ui/onboarding.rsindex 94c9b2a07..148574d69 100644--- a/src/ui/onboarding.rs+++ b/src/ui/onboarding.rs@@ -7,7 +7,6 @@ pub(crate) const ONBOARDING_DESCRIPTION: [&str; 3] = [" click the sidebar to switch workspaces, drag pane"," borders to resize, right-click for context menus.",];-pub(crate) const ONBOARDING_PREFIX_LABEL: &str = "ctrl+b";pub(crate) const ONBOARDING_PREFIX_SUFFIX: &str = " enters prefix mode · ";pub(crate) const ONBOARDING_HELP_LABEL: &str = "?";pub(crate) const ONBOARDING_HELP_SUFFIX: &str = " shows keybinds and settings";