Commit 252f6c1
committed
fix(tools): Route select_pane next/previous via absolute pane_id for older tmux
why: CI exposed that the prior fix (server.cmd with target=
f"{window.window_id}.+") still fails on tmux 3.2a: targeting a
non-active window routes focus back to the client's current window.
The relative-pane-offset parser for scoped window targets like
@window_id.+ behaves differently across tmux releases — 3.6-alpha
resolves it correctly; 3.2a falls back to client curw. The CI
trace shows a returned pane with window_id='@1' when the call
targeted '@2', confirming the same class of misrouting the earlier
fix was meant to eliminate.
Sidestep the tmux-version variation by skipping relative-target
syntax entirely: enumerate the targeted window's panes, find the
currently-active one, compute next/previous by index with
wrap-around, and select by absolute pane_id. tmux accepts absolute
pane_ids uniformly across every version, and `pane_active` on the
target window is set regardless of whether the client is focused
on that window.
what:
- Collapse the `next` and `previous` branches into a single
compute-by-index block. `window.refresh()` ensures
`pane_active` reflects current state; then walk window.panes,
locate the active one, advance by ±1 (mod len), and dispatch
`server.cmd("select-pane", target=target_pane.pane_id)`.
- Replace the two previous comment blocks with a single one that
explains both portability concerns (bare +/- uses client curw,
scoped @id.+ is version-dependent).
- No test change needed —
test_select_pane_next_previous_respects_target_window already
verifies the correct behavior; it was failing only on older
tmux versions because the previous fix was version-specific.1 parent b5bd00d commit 252f6c1
1 file changed
Lines changed: 20 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
875 | 875 | | |
876 | 876 | | |
877 | 877 | | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
887 | 898 | | |
888 | 899 | | |
889 | 900 | | |
| |||
0 commit comments