Split Ctrl+W: close-tab vs close-pane shortcuts#19
Draft
mvbmir wants to merge 1 commit into
Draft
Conversation
Previously Ctrl+W closed the whole pane. That's surgery — the common case for most users is closing a single tab. Add a dedicated CloseFocusedTab shortcut and move CloseFocusedPane out of the way. - New ShortcutId / ShortcutCommand: CloseFocusedTab. Default accel: <Ctrl>w. Closes the active tab in the focused pane; when the last tab closes, the pane's on_empty callback fires and the pane is removed (and the workspace if that was the last pane). - CloseFocusedPane default accel remapped from <Ctrl>w to <Ctrl><Alt>w. Still closes the whole pane (all its tabs). - Added pane::close_active_tab_in_pane() — the underlying helper that the new shortcut dispatches to. Same code path as the close X on each tab and the middle-click close. - Close pane button tooltip already renders the current keybinding via pane_action_tooltip / shortcuts.tooltip_text, so it automatically reflects the new Ctrl+Alt+W default and any user remaps — no code change needed there. - definitions_cover_current_host_shortcuts test updated (47 → 48). Users with an existing shortcuts.json keeping the old "close_focused_pane" override will continue to see their chosen binding for that action; they'll need to bind close_focused_tab themselves if the default Ctrl+W is not what they want.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #18. Previously
Ctrl+Wclosed the entire pane (including all its tabs), which is surgery most users don't want by default. This PR splits the bindings so the common case (close one tab) has the familiar shortcut and the aggressive one moves to a modifier.close_focused_tab— defaultCtrl+W. Closes the active tab in the focused pane. If that was the last tab, the pane's existingon_emptycallback fires and the pane is removed (and the workspace if it was the last pane).close_focused_pane— defaultCtrl+Alt+W(wasCtrl+W). Same behavior as before — closes the whole pane with all its tabs.pane_action_tooltip→shortcuts.tooltip_text), so it automatically reflects whichever binding is active, including user overrides.Base: mvbmir/monitor-ghostty-actions (the redesign PR #18). Will rebase / base-change to
mainafter #18 merges.Follow-ups to consider before merging
Notes for reviewers
shortcuts.jsonoverrides forclose_focused_panekeep their existing binding. Users who wantCtrl+Wto still close the whole pane can restore that by bindingclose_focused_paneto<Ctrl>win the editor (and rebindingclose_focused_tabelsewhere or clearing it).Test plan
cargo fmtcleancargo clippy --release -- -D warningscleancargo test— all 154 unit tests pass (definition count updated 47 → 48)Ctrl+Wcloses a single tab, pane stays when 2+ tabs presentCtrl+Won a pane's last tab closes the paneCtrl+Won the workspace's last pane's last tab closes the workspaceCtrl+Alt+Wcloses the pane regardless of tab countClose Focused TabandClose Focused Pane; both can be remapped and cleared