Repository navigation
feat(ui): add Alt+Left/Alt+Right tab history - #752
Merged
Merged
Conversation
Keep a bounded back/forward stack of visited tabs so Alt+Left returns to the previous view (e.g. Details back to Overview) and Alt+Right undoes it. Terminals that can remap the X1/X2 mouse buttons can map them to these keys until crossterm reports those buttons. Refs domcyrus#274
Map Alt+b / Alt+f alongside Alt+Left / Alt+Right so Option+Left / Option+Right work out of the box in macOS terminals that send Esc b / Esc f by default (Ghostty, Terminal.app, iTerm2). Route the remaining direct tab switches in Overview and Activity through jump_to_tab so record_tab_change stays private, and combine the duplicate tab-navigation guard in dispatch_key.
Owner
|
@JROtto5 Thanks a lot for your PR. I did push a small change so that I can test it on macOS. |
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
Adds the keyboard half of #274:
Alt+Leftgoes back to the previous tab andAlt+Rightgoes forward again, so Enter on a connection and thenAlt+Leftreturns to Overview from wherever you came. As you suggested there, terminals that can remap the mouse back/forward buttons can map them to these keys until crossterm reports X1/X2.UiStatekeeps a back stack (last 16 tabs) and a forward stack. Every tab switch goes throughjump_to_tabor, for the few places that setselected_tabdirectly (Enter to Details, Esc to Overview, Activity'soand Esc), records the switch first. Any new switch clears the forward stack, like a browser. A tab reached through history behaves like one reached with1-5, so Details opened from a finding no longer sends Esc back to Findings after Alt+Left/Alt+Right. The keys are handled indispatch_keynext to1-5, so they work on every tab (Overview claims plain Left/Right for groups) and with help open, but not while typing a filter.Linked issue
Related issue: #274 (keyboard part; the X1/X2 mouse part still needs crossterm).
Verification
Run on Linux (x86_64). This machine has no pkg-config/libelf headers, so the
ebpffeature couldn't be built; the checks used--no-default-features --features landlock,macos-sandbox,kubernetes. Nothing in the eBPF code changed.cargo fmt --all -- --checkcargo clippy --locked --workspace --all-targets -- -D warnings(features above)cargo test --locked --workspace(features above): all pass except 16app::outputtests that fail the same way onmainin this environment. New tests:go_back_and_forward_walk_tab_history,tab_history_drops_return_to_finding,tab_history_is_bounded,alt_arrows_walk_tab_history_from_any_tab; two help overlay snapshots updated for the new row.cargo build --locked --workspace --all-targets --release(features above)Scope
#[allow(clippy::...)]suppressions## [Unreleased]section ofCHANGELOG.mdNotes for the reviewer
macOS Terminal.app sends
Esc b/Esc ffor Option+Left/Right unless "Use Option as Meta key" is on, so there these keys need that setting. I can also map Alt+b / Alt+f if you'd like.