Files
tty7/src
l0ng-aiandl0ng-ai a2c1763de9 fix(terminal): keep each tab's active pane across tab switches (#84)
* fix(terminal): keep each tab's active pane across tab switches

Switching tabs reset the target tab to its first pane: focus_active
always focused first_leaf, and a Tab stored no notion of which pane was
active. Tab labels had the same root cause — an inactive tab holds no
window focus, so leaf_title always fell back to the first pane.

Record the focused pane per tab (Tab::last_focused) when leaving it or
opening a focus-stealing overlay (Settings), and restore it on return
via Tab::focus_target, degrading to first_leaf when the remembered pane
has closed. leaf_title now uses the live focus for the active tab and
the remembered pane for inactive tabs, so background labels track the
pane each tab is working in.

Add Pane::leaf_matching_or_first as the pure selection rule, unit-tested
against the u32 leaf model.

* fix(terminal): remember the active pane on every tab-leaving path

Cmd+T (new_tab_with_shell), native-SSH new tab (open_native_ssh_tab), and
reopen-closed-tab (Cmd+Shift+T) all move the active tab away without going
through activate(), so the departed tab never recorded its focused pane and
switching back jumped to the first leaf — the exact bug this branch fixes,
reachable from its most common entry point. Snapshot via remember_active_pane
before the switch in all three.

---------

Co-authored-by: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com>
2026-07-15 14:21:06 +08:00
..