Fix Ctrl+Tab chat window navigation

Keep Ctrl+Tab scoped to shown floating chats when windows are visible, and otherwise cycle only visible tiled panes. Remove the single-pane recent-chat swap and use stable floating-window open order so raising a window does not alter navigation.
This commit is contained in:
2026-11-12 01:59:52 +00:00
parent 2330f50268
commit c05a4da476
8 changed files with 173 additions and 125 deletions
+49 -19
View File
@@ -29,14 +29,25 @@ every destination and come back at app start without Chat being opened.
terminal). On macOS Ctrl+Y in a terminal always goes to the shell.
- **Focus**: a window that shows or comes to the top puts the keyboard in its
composer; hiding the last window gives it back to what had it.
- **Cycle**: while a floating chat window's content holds the keyboard (a
composer, a Files page inside it), Ctrl+Tab brings the next visible chat
window to the top and Ctrl+Shift+Tab the previous one, wrapping round. The
order is the stacking order, bottom to top, and the window's composer takes
the keyboard. Command+Tab stays with the system. With the tiling focused,
Ctrl+Tab still cycles its panes; while the terminal claims tab keys (shown)
it switches terminal tabs. Alt+` (`windowCycleShortcut`) still cycles every
kind of window, not only chats.
- **Cycle**: Ctrl+Tab and Ctrl+Shift+Tab move between the chats the user can
see, and never bring up one that is not shown.
- **While any chat window is shown** (not minimised, its group shown), the
keys cycle those windows only, from wherever the keyboard is in Chat: a
window's composer, a Files page inside it, or the tiling (the chat list
included). From a window, the next (previous) shown window in open order
comes to the top, wrapping round. From the tiling, Ctrl+Tab takes the
top-most shown window to the top first. Either way the window's composer
takes the keyboard. Open order is the order the windows were opened (a
restored window keeps its saved place), so a raise does not change the
cycle; the stacking order does change on a raise.
- **With no chat window shown**, Ctrl+Tab cycles the tiled panes only and
the keys focus the chosen pane's composer. With one tiled pane it does
nothing. A chat shown before, or a minimised or floating chat, is never
swapped in.
- Command+Tab stays with the system. While the terminal claims tab keys
(shown) Ctrl+Tab switches terminal tabs. A keyboard held by another window
(a run, terminal) is left to that window. Alt+` (`windowCycleShortcut`)
still cycles every kind of window, not only chats.
- **Popups**: sheets, dialogs, menus and tooltips opened from a floating chat
are above every window. Files opens as a page inside the window, and a file
opened from it stays in the window. Because the window's own title bar names
@@ -68,17 +79,36 @@ every destination and come back at app start without Chat being opened.
## Checks
- Focused, 2026-11-12, `tool/memwatch/full.sh` with
`test/features/chat/chat_floating_pane_test.dart` and
`test/features/terminal/terminal_chat_tab_test.dart`: 16 passed, 0 failed.
New in the first: Ctrl+Tab and Ctrl+Shift+Tab over three floating chats
(order, wrap, composer focus, Command+Tab ignored); with the tiling focused
Ctrl+Tab moves the active pane and leaves the windows alone, and with one
window focused it does nothing; a terminal that claims tab keys keeps
Ctrl+Tab over a focused chat window.
- `tool/analyze.sh` on the changed paths: clean.
- Affected states: two or more floating chats; one floating chat; tiling
focused; a window focused with the terminal shown (claimed); Command+Tab.
- Focused, 2026-11-12, `tool/memwatch/full.sh` over
`test/features/chat/chat_floating_pane_test.dart`,
`test/features/chat/chat_keyboard_focus_test.dart`,
`test/features/chat/chat_control_tab_test.dart`,
`test/features/chat/windows/chat_windows_test.dart` and
`test/features/terminal/terminal_chat_tab_test.dart`: 38 passed, 0 failed.
Related Ctrl+Tab users, `tool/memwatch/full.sh` over
`test/shell/destination_shortcuts_test.dart`,
`test/shell/tab_history_back_test.dart`, `test/shell/search_escape_test.dart`
and `test/features/chat/shell/chat_shell_terminal_test.dart`: 26 passed,
0 failed.
- New in the first file: Ctrl+Tab and Ctrl+Shift+Tab over three floating chats
cycle in open order, not stacking order (order, wrap, composer focus,
Command+Tab ignored). With the tiling focused Ctrl+Tab goes to the top-most
shown window and leaves the panes alone; with one shown window it does
nothing; with the window minimised the panes cycle and the window stays
hidden. With one tiled pane and a minimised chat, Ctrl+Tab does nothing and
shows nothing. A terminal that claims tab keys keeps Ctrl+Tab over a focused
chat window.
- Removed: the single-pane recent-chat swap (the chat shown before, opened
back into the pane), with its tests in `chat_keyboard_focus_test.dart`. A
single pane with no shown window now does nothing on Ctrl+Tab, so
`chat_control_tab_test.dart` no longer expects the composer to take focus
from the sidebar.
- `tool/analyze.sh` on `lib/features/chat` and the three chat test files:
clean.
- Affected states: two or more floating chats; one floating chat shown;
floating chat minimised with one tiled pane; tiling focused with windows
shown and with none; a window focused; the terminal shown (claimed);
Command+Tab.
- Not covered: the terminal's own tab switching (the test app has no terminal
surface), real browser or device keys, and captures (ui-review's).
- Observed, not changed: in the widget harness, floating from a pane's More