Chat: slash focuses the composer; Ctrl+Tab over one pane toggles recent chats
A bare / typed outside any text field puts the keyboard in the active chat's composer through the existing focus request, after the frame, so the slash is not typed into it. Ctrl+Tab with a single pane now swaps in the chat shown before the current one and back; two or more panes keep cycling panes. The visit remembers its shown chats most-recent-first, dropping closed, /new-moved and other-server ids.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Slash focuses the composer; Ctrl+Tab over one pane toggles recent chats
|
||||
|
||||
`lib/features/chat/chat_screen_keys.dart` (a part of `screen.dart`) adds two
|
||||
Chat-destination keys, registered on `HardwareKeyboard` for the screen's
|
||||
lifetime like the pane cycling in `chat_screen_workspace.dart`:
|
||||
|
||||
- A bare `/` (matched on the typed character, so it follows the keyboard
|
||||
layout; Ctrl/Alt/Meta chords are left alone, Ctrl+/ stays the shell's Search)
|
||||
requests focus for the active pane's composer through the existing
|
||||
`ChatComposerFocusRequests`. The composer takes it after the frame, once the
|
||||
host has finished delivering the keystroke, so the slash is not typed into
|
||||
it. Nothing happens while any editable text field has focus, while a popup
|
||||
or dialog is open, or on another destination.
|
||||
- Ctrl+Tab (and Ctrl+Shift+Tab) over a single pane swaps in the chat shown
|
||||
before the active one, composer focused, and back again. With no earlier
|
||||
chat this visit it still just focuses the composer; with two or more panes
|
||||
the existing pane cycling is unchanged.
|
||||
|
||||
The visit keeps a most-recent-first list of the chats the workspace has shown
|
||||
(bounded to eight, in memory). It is noted on every workspace change, including
|
||||
a restored layout and the routed first chat; a chat `/close`d or moved by
|
||||
`/new` is dropped, and a server switch clears it.
|
||||
|
||||
Tests: `test/features/chat/chat_keyboard_focus_test.dart`. Widget tests cannot
|
||||
show a browser's text insertion, so "the slash is not typed" rests on the
|
||||
post-frame focus request; the composer text is asserted empty.
|
||||
Reference in New Issue
Block a user