diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/actions.rs | 12 | ||||
| -rw-r--r-- | src/app/input/modal.rs | 4 | ||||
| -rw-r--r-- | src/app/input/navigate.rs | 16 | ||||
| -rw-r--r-- | src/app/state.rs | 8 | ||||
| -rw-r--r-- | src/config/keybinds.rs | 29 | ||||
| -rw-r--r-- | src/config/model.rs | 7 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/persist/snapshot.rs | 2 | ||||
| -rw-r--r-- | src/ui/keybind_help.rs | 2 | ||||
| -rw-r--r-- | src/ui/menus.rs | 4 |
10 files changed, 49 insertions, 37 deletions
diff --git a/src/app/actions.rs b/src/app/actions.rs index faa5717d..b7634c3c 100644 --- a/src/app/actions.rs +++ b/src/app/actions.rs @@ -576,7 +576,7 @@ impl AppState { } } - pub fn toggle_fullscreen(&mut self) { + pub fn toggle_zoom(&mut self) { if let Some(tab) = self .active .and_then(|i| self.workspaces.get_mut(i)) @@ -1652,21 +1652,21 @@ mod tests { } #[test] - fn toggle_fullscreen_works() { + fn toggle_zoom_works() { let mut state = app_with_workspaces(&["test"]); state.workspaces[0].test_split(Direction::Horizontal); assert!(!state.workspaces[0].zoomed); - state.toggle_fullscreen(); + state.toggle_zoom(); assert!(state.workspaces[0].zoomed); - state.toggle_fullscreen(); + state.toggle_zoom(); assert!(!state.workspaces[0].zoomed); } #[test] - fn toggle_fullscreen_single_pane_noop() { + fn toggle_zoom_single_pane_noop() { let mut state = app_with_workspaces(&["test"]); - state.toggle_fullscreen(); + state.toggle_zoom(); assert!(!state.workspaces[0].zoomed); } diff --git a/src/app/input/modal.rs b/src/app/input/modal.rs index 6de349cb..f40684f1 100644 --- a/src/app/input/modal.rs +++ b/src/app/input/modal.rs @@ -494,8 +494,8 @@ pub(super) fn apply_context_menu_action(state: &mut AppState, menu: ContextMenuS state.split_pane(Direction::Vertical); state.mode = Mode::Terminal; } - (ContextMenuKind::Pane { .. }, Some("Fullscreen")) => { - state.toggle_fullscreen(); + (ContextMenuKind::Pane { .. }, Some("Zoom")) => { + state.toggle_zoom(); state.mode = Mode::Terminal; } (ContextMenuKind::Pane { .. }, Some("Close pane")) => { diff --git a/src/app/input/navigate.rs b/src/app/input/navigate.rs index 798aafa8..9ab3de28 100644 --- a/src/app/input/navigate.rs +++ b/src/app/input/navigate.rs @@ -485,7 +485,7 @@ pub(crate) enum NavigateAction { SplitHorizontal, ClosePane, EditScrollback, - Fullscreen, + Zoom, EnterResizeMode, ToggleSidebar, ReloadConfig, @@ -609,8 +609,8 @@ fn navigate_action_for_key(state: &AppState, key: &KeyEvent) -> Option<NavigateA if key_matches(key, kb.close_pane.0, kb.close_pane.1) { return Some(NavigateAction::ClosePane); } - if key_matches(key, kb.fullscreen.0, kb.fullscreen.1) { - return Some(NavigateAction::Fullscreen); + if key_matches(key, kb.zoom.0, kb.zoom.1) { + return Some(NavigateAction::Zoom); } if key_matches(key, kb.resize_mode.0, kb.resize_mode.1) { return Some(NavigateAction::EnterResizeMode); @@ -744,8 +744,8 @@ pub(super) fn execute_navigate_action(state: &mut AppState, action: NavigateActi leave_navigate_mode(state); } NavigateAction::EditScrollback => {} - NavigateAction::Fullscreen => { - state.toggle_fullscreen(); + NavigateAction::Zoom => { + state.toggle_zoom(); leave_navigate_mode(state); } NavigateAction::EnterResizeMode => state.mode = Mode::Resize, @@ -1192,11 +1192,11 @@ mod tests { } #[test] - fn fullscreen_action_exits_navigate_mode() { + fn zoom_action_exits_navigate_mode() { let mut state = state_with_workspaces(&["test"]); state.workspaces[0].test_split(Direction::Horizontal); - state.keybinds.fullscreen = (KeyCode::Char('g'), KeyModifiers::empty()); - state.keybinds.fullscreen_label = "g".into(); + state.keybinds.zoom = (KeyCode::Char('g'), KeyModifiers::empty()); + state.keybinds.zoom_label = "g".into(); handle_navigate_key( &mut state, diff --git a/src/app/state.rs b/src/app/state.rs index ff5357b2..10631157 100644 --- a/src/app/state.rs +++ b/src/app/state.rs @@ -759,7 +759,7 @@ impl ContextMenuState { "Clear pane name", "Split vertical", "Split horizontal", - "Fullscreen", + "Zoom", "Close pane", ], ContextMenuKind::Pane { @@ -769,7 +769,7 @@ impl ContextMenuState { "Rename pane", "Split vertical", "Split horizontal", - "Fullscreen", + "Zoom", "Close pane", ], } @@ -1192,8 +1192,8 @@ impl AppState { split_horizontal_label: "-".into(), close_pane: (KeyCode::Char('x'), KeyModifiers::empty()), close_pane_label: "x".into(), - fullscreen: (KeyCode::Char('f'), KeyModifiers::empty()), - fullscreen_label: "f".into(), + zoom: (KeyCode::Char('f'), KeyModifiers::empty()), + zoom_label: "f".into(), resize_mode: (KeyCode::Char('r'), KeyModifiers::empty()), resize_mode_label: "r".into(), toggle_sidebar: (KeyCode::Char('b'), KeyModifiers::empty()), diff --git a/src/config/keybinds.rs b/src/config/keybinds.rs index 9a1dc496..13d65ec3 100644 --- a/src/config/keybinds.rs +++ b/src/config/keybinds.rs @@ -111,8 +111,8 @@ pub struct Keybinds { pub split_horizontal_label: String, pub close_pane: (KeyCode, KeyModifiers), pub close_pane_label: String, - pub fullscreen: (KeyCode, KeyModifiers), - pub fullscreen_label: String, + pub zoom: (KeyCode, KeyModifiers), + pub zoom_label: String, pub resize_mode: (KeyCode, KeyModifiers), pub resize_mode_label: String, pub toggle_sidebar: (KeyCode, KeyModifiers), @@ -362,8 +362,8 @@ impl Config { ), required_binding( BindingScope::Navigate, - "keys.fullscreen", - &self.keys.fullscreen, + "keys.zoom", + &self.keys.zoom, "f", (KeyCode::Char('f'), KeyModifiers::empty()), &mut diagnostics, @@ -791,8 +791,8 @@ impl Config { split_horizontal_label: bindings[5].label.clone(), close_pane: bindings[6].value, close_pane_label: bindings[6].label.clone(), - fullscreen: bindings[7].value, - fullscreen_label: bindings[7].label.clone(), + zoom: bindings[7].value, + zoom_label: bindings[7].label.clone(), resize_mode: bindings[8].value, resize_mode_label: bindings[8].label.clone(), toggle_sidebar: bindings[9].value, @@ -1093,7 +1093,7 @@ mod tests { assert_eq!(kb.split_horizontal.0, KeyCode::Char('-')); assert_eq!(kb.close_pane.0, KeyCode::Char('x')); assert_eq!(kb.edit_scrollback, None); - assert_eq!(kb.fullscreen.0, KeyCode::Char('f')); + assert_eq!(kb.zoom.0, KeyCode::Char('f')); assert_eq!(kb.resize_mode.0, KeyCode::Char('r')); assert_eq!(kb.toggle_sidebar.0, KeyCode::Char('b')); assert!(kb.custom_commands.is_empty()); @@ -1110,7 +1110,7 @@ close_workspace = "ctrl+d" split_vertical = "s" split_horizontal = "shift+s" close_pane = "ctrl+w" -fullscreen = "z" +zoom = "z" resize_mode = "ctrl+r" toggle_sidebar = "tab" previous_agent = "alt+a" @@ -1143,7 +1143,7 @@ focus_pane_right = "alt+right" (KeyCode::Char('s'), KeyModifiers::SHIFT) ); assert_eq!(kb.close_pane, (KeyCode::Char('w'), KeyModifiers::CONTROL)); - assert_eq!(kb.fullscreen.0, KeyCode::Char('z')); + assert_eq!(kb.zoom.0, KeyCode::Char('z')); assert_eq!(kb.resize_mode, (KeyCode::Char('r'), KeyModifiers::CONTROL)); assert_eq!(kb.toggle_sidebar, (KeyCode::Tab, KeyModifiers::empty())); assert_eq!( @@ -1168,6 +1168,17 @@ focus_pane_right = "alt+right" } #[test] + fn legacy_fullscreen_keybind_alias_maps_to_zoom() { + let toml = r#" +[keys] +fullscreen = "z" +"#; + let config: Config = toml::from_str(toml).unwrap(); + let kb = config.keybinds(); + assert_eq!(kb.zoom.0, KeyCode::Char('z')); + } + + #[test] fn uppercase_keybind_from_toml_flows_into_shift_combo() { let toml = r#" [keys] diff --git a/src/config/model.rs b/src/config/model.rs index f9522e41..60a8859c 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -119,8 +119,9 @@ pub struct KeysConfig { pub split_horizontal: String, /// Close the focused pane. Default: "x" pub close_pane: String, - /// Toggle fullscreen for the focused pane. Default: "f" - pub fullscreen: String, + /// Toggle zoom for the focused pane. Default: "f" + #[serde(alias = "fullscreen")] + pub zoom: String, /// Enter resize mode. Default: "r" pub resize_mode: String, /// Toggle sidebar collapse. Default: "b" @@ -210,7 +211,7 @@ impl Default for KeysConfig { split_vertical: "v".into(), split_horizontal: "-".into(), close_pane: "x".into(), - fullscreen: "f".into(), + zoom: "f".into(), resize_mode: "r".into(), toggle_sidebar: "b".into(), indexed: IndexedKeysConfig::default(), diff --git a/src/main.rs b/src/main.rs index 441f3588..79a5d544 100644 --- a/src/main.rs +++ b/src/main.rs @@ -106,7 +106,7 @@ const DEFAULT_CONFIG: &str = r##"# herdr configuration # split_vertical = "v" # split_horizontal = "-" # close_pane = "x" -# fullscreen = "f" +# zoom = "f" # legacy alias: fullscreen # resize_mode = "r" # toggle_sidebar = "b" diff --git a/src/persist/snapshot.rs b/src/persist/snapshot.rs index f9198e16..96b6074a 100644 --- a/src/persist/snapshot.rs +++ b/src/persist/snapshot.rs @@ -642,7 +642,7 @@ mod tests { let root = state.workspaces[0].tabs[0].root_pane; let second = state.workspaces[0].test_split(Direction::Horizontal); state.workspaces[0].tabs[0].layout.focus_pane(second); - state.toggle_fullscreen(); + state.toggle_zoom(); let snapshot = capture_from_state(&state); let tab = &snapshot.workspaces[0].tabs[0]; diff --git a/src/ui/keybind_help.rs b/src/ui/keybind_help.rs index 7b524be8..e7a76155 100644 --- a/src/ui/keybind_help.rs +++ b/src/ui/keybind_help.rs @@ -108,7 +108,7 @@ pub(super) fn keybind_help_groups( optional_keybind_label(&kb.edit_scrollback_label), "edit scrollback", ), - (kb.fullscreen_label.clone(), "fullscreen"), + (kb.zoom_label.clone(), "zoom pane"), (kb.resize_mode_label.clone(), "resize mode"), (kb.toggle_sidebar_label.clone(), "toggle sidebar"), ( diff --git a/src/ui/menus.rs b/src/ui/menus.rs index 537ac9a1..7a074c68 100644 --- a/src/ui/menus.rs +++ b/src/ui/menus.rs @@ -47,8 +47,8 @@ pub(super) fn render_navigate_overlay(app: &AppState, frame: &mut Frame, area: R Span::styled(" split─ ", dim), Span::styled(kb.close_pane_label.as_str(), key), Span::styled(" close ", dim), - Span::styled(kb.fullscreen_label.as_str(), key), - Span::styled(" full ", dim), + Span::styled(kb.zoom_label.as_str(), key), + Span::styled(" zoom ", dim), Span::styled(kb.resize_mode_label.as_str(), key), Span::styled(" resize ", dim), Span::styled("?", key), |
