the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
add close action button to keybind help
Ogulcan Celik1eb7dac77e7b
diff --git a/src/app/input.rs b/src/app/input.rsindex 0e6c5b621..d3a94596f 100644--- a/src/app/input.rs+++ b/src/app/input.rs@@ -1494,7 +1494,25 @@ impl AppState {&& mouse.column < rect.x + rect.width&& mouse.row >= rect.y&& mouse.row < rect.y + rect.height;- if !inside {+ let inner = Rect::new(+ rect.x + 1,+ rect.y + 1,+ rect.width.saturating_sub(2),+ rect.height.saturating_sub(2),+ );+ let close = crate::ui::keybind_help_close_button_rect(Rect::new(+ inner.x,+ inner.y,+ inner.width,+ 1,+ ));+ if modal_action_from_buttons(+ mouse.column,+ mouse.row,+ &[(close, ModalAction::Close)],+ ) == Some(ModalAction::Close)+ || !inside+ {leave_modal(self);}}@@ -2505,6 +2523,29 @@ mod tests {assert_eq!(app.state.mode, Mode::Settings);}+ #[test]+ fn clicking_keybind_help_close_button_closes_overlay() {+ let mut app = app_for_mouse_test();+ app.state.mode = Mode::KeybindHelp;++ let rect = app.state.keybind_help_rect();+ let inner = Rect::new(+ rect.x + 1,+ rect.y + 1,+ rect.width.saturating_sub(2),+ rect.height.saturating_sub(2),+ );+ let close =+ crate::ui::keybind_help_close_button_rect(Rect::new(inner.x, inner.y, inner.width, 1));+ app.handle_mouse(mouse(+ MouseEventKind::Down(MouseButton::Left),+ close.x,+ close.y,+ ));++ assert_eq!(app.state.mode, Mode::Navigate);+ }+#[test]fn hovering_context_menu_updates_highlight() {let mut app = app_for_mouse_test();diff --git a/src/ui.rs b/src/ui.rsindex 20f37b5aa..c48d1e7cf 100644--- a/src/ui.rs+++ b/src/ui.rs@@ -1624,6 +1624,18 @@ fn keybind_help_groups(app: &AppState) -> Vec<(&'static str, Vec<(String, &'statgroups}+pub(crate) fn keybind_help_close_button_rect(area: Rect) -> Rect {+ action_button_row_rects(+ area,+ &[ActionButtonSpec {+ hint: Some("esc"),+ label: "close",+ }],+ 0,+ 0,+ )[0]+}+fn render_keybind_help_overlay(app: &AppState, frame: &mut Frame) {let rect = app.keybind_help_rect();let Some(inner) = render_panel_shell(frame, rect, app.palette.accent, app.palette.panel_bg)@@ -1644,14 +1656,20 @@ fn render_keybind_help_overlay(app: &AppState, frame: &mut Frame) {.fg(app.palette.mauve).add_modifier(Modifier::BOLD);let label_style = Style::default().fg(app.palette.text);- let hint_style = Style::default().fg(app.palette.overlay0);-+ let header = Rect::new(inner.x, inner.y, inner.width, 1);frame.render_widget(- Paragraph::new(Line::from(vec![- Span::styled(" keybinds", title_style),- Span::styled(" esc to close", hint_style),- ])),- Rect::new(inner.x, inner.y, inner.width, 1),+ Paragraph::new(Line::from(vec![Span::styled(" keybinds", title_style)])),+ header,+ );+ render_action_button(+ frame,+ keybind_help_close_button_rect(header),+ Some("esc"),+ "close",+ Style::default()+ .fg(app.palette.text)+ .bg(app.palette.surface0)+ .add_modifier(Modifier::BOLD),);let groups = keybind_help_groups(app);