Skip to content

feat(ui): add Alt+Left/Alt+Right tab history - #752

Merged
domcyrus merged 2 commits into
domcyrus:mainfrom
JROtto5:feat/tab-history-alt-arrows
Nov 25, 2026
Merged

domcyrus merged 2 commits into
domcyrus:mainfrom
JROtto5:feat/tab-history-alt-arrows

Conversation

@JROtto5

@JROtto5 JROtto5 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the keyboard half of #274: Alt+Left goes back to the previous tab and Alt+Right goes forward again, so Enter on a connection and then Alt+Left returns 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.

UiState keeps a back stack (last 16 tabs) and a forward stack. Every tab switch goes through jump_to_tab or, for the few places that set selected_tab directly (Enter to Details, Esc to Overview, Activity's o and Esc), records the switch first. Any new switch clears the forward stack, like a browser. A tab reached through history behaves like one reached with 1-5, so Details opened from a finding no longer sends Esc back to Findings after Alt+Left/Alt+Right. The keys are handled in dispatch_key next to 1-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 ebpf feature couldn't be built; the checks used --no-default-features --features landlock,macos-sandbox,kubernetes. Nothing in the eBPF code changed.

  • cargo fmt --all -- --check
  • cargo clippy --locked --workspace --all-targets -- -D warnings (features above)
  • cargo test --locked --workspace (features above): all pass except 16 app::output tests that fail the same way on main in 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

  • One feature or fix per PR (no unrelated cleanups bundled in)
  • I reviewed the changes and the description matches the diff
  • No new dependencies
  • No #[allow(clippy::...)] suppressions
  • User-visible changes are added to the ## [Unreleased] section of CHANGELOG.md

Notes for the reviewer

macOS Terminal.app sends Esc b / Esc f for 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.

JROtto5 and others added 2 commits November 24, 2026 06:21
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.
@domcyrus

Copy link
Copy Markdown
Owner

@JROtto5 Thanks a lot for your PR. I did push a small change so that I can test it on macOS.

@domcyrus
domcyrus merged commit 21a4d76 into domcyrus:main Nov 25, 2026
33 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants