Float several chats and keep them working on every tab
Floating chats were stuck on other destinations: the hidden Chat tab muted the window's hide animation, so the window stayed painted but took no input. The reveal now uses its own ticker, each floating pane's focus scope hangs from a FloatingFocusRoot above the destination stack, and the windows show over every destination like the terminal. Any number of chats can float; the shortcut, a window's X and the menu show or hide them together. Each pane keeps its own frame (also while docked), saved in record version 2; version 1 records still load. Drags read the live frame so fast pointer events no longer lose movement.
This commit is contained in:
@@ -1,24 +1,29 @@
|
||||
# Floating chat pane
|
||||
|
||||
On a wide layout one chat at a time can leave the split tiling and float in a
|
||||
window over the app, like the floating terminal. Ctrl+Y (Cmd+Y on macOS)
|
||||
shows or hides it.
|
||||
On a wide layout chats can leave the split tiling and float in windows over
|
||||
the app, like the floating terminal. Ctrl+Y (Cmd+Y on macOS) shows or hides
|
||||
all of them together, on every destination.
|
||||
|
||||
## Behaviour
|
||||
|
||||
- **Float**: a tiled pane's More menu offers `Float (Ctrl+Y)` (`Cmd+Y` on Apple
|
||||
platforms) when another chat stays in the tiling. A single chat cannot float,
|
||||
because the tiling would be empty. Floating a second chat swaps them: the chat
|
||||
that was floating goes back into the tiling where the new one was.
|
||||
platforms) when another chat stays in the tiling. The last tiled chat cannot
|
||||
float, because the tiling would be empty. Any number of chats can float;
|
||||
floating one shows every floating chat. A new window opens at the default
|
||||
frame stepped 32 px down and right per window already floating.
|
||||
- **Show / hide**: the chord, a window's X and the menu's `Hide floating chats`
|
||||
show or hide all floating windows at once. Each window keeps its own frame,
|
||||
so they come back exactly where they were.
|
||||
- **Window**: you drag it by its title bar and resize it from the lower right
|
||||
corner. The title bar has Dock and Hide buttons. The window keeps its frame
|
||||
inside the app when the browser window resizes (`fitChatFloat`). Grow and fade
|
||||
in, and shrink and fade out, use `Motion.standard` through `Motion.of`, so
|
||||
reduced motion and the animation speed apply.
|
||||
reduced motion and the animation speed apply. Each window animates on its
|
||||
own, so a chat floated while others show grows in alone.
|
||||
- **Floating chat's menu**: Dock (back into the tiling, right of the active pane,
|
||||
which it becomes), `Hide floating chat (Ctrl+Y)`, and Close pane (removes it
|
||||
from the workspace; no backend close). If the last tiled pane closes, the
|
||||
floating chat docks in its place.
|
||||
which it becomes; the others keep floating), `Hide floating chats (Ctrl+Y)`,
|
||||
and Close pane (removes it from the workspace; no backend close). If the last
|
||||
tiled pane closes, the oldest floating chat docks in its place.
|
||||
- **Shortcut**: Ctrl+Y on every platform, and Cmd+Y on macOS and iOS. It is an
|
||||
early key handler, so it works from a composer or the terminal; Y, Shift+Y and
|
||||
Alt+Y still type. When no chat floats, Ctrl+Y floats the tiled pane that has
|
||||
@@ -30,23 +35,37 @@ shows or hides it.
|
||||
- **Focus**: showing the chat focuses its composer. Hiding it gives the keyboard
|
||||
back to whatever had it before (as `TerminalFocus` does), otherwise the
|
||||
keyboard is unfocused.
|
||||
- **Where it shows**: only on a wide layout and while Chat is the current
|
||||
destination. On narrow or phone layouts, and on other destinations, the menu
|
||||
item is absent and the chord passes through. A chat that is already floating
|
||||
stays floating there, unpainted, with its state, and reappears when the
|
||||
window is wide again.
|
||||
- **Where it shows**: on a wide layout, over every destination (Runs,
|
||||
Pipelines, Settings...), like the floating terminal. The windows move,
|
||||
resize, type, hide and dock there as on Chat. On narrow or phone layouts the
|
||||
menu item is absent and the chord passes through; floating chats stay
|
||||
floating, unpainted, with their state, and reappear when the window is wide
|
||||
again.
|
||||
- **Other destinations (how)**: the shell hides a destination with
|
||||
`FadeThroughStack` (muted tickers, no input, no focus). The windows already
|
||||
paint and hit-test in the root overlay; the host also re-enables tickers
|
||||
around each window (`TickerMode`) and parents each floating pane's
|
||||
`FocusScope` on the shell's `FloatingFocusRoot`
|
||||
(`ui/floating/floating_layer.dart`, above the destination stack), so a
|
||||
hidden destination's `ExcludeFocus` does not take its keyboard. Before this,
|
||||
leaving Chat started the hide animation on a muted ticker: the window stayed
|
||||
painted but ignored input, so it could not be moved or closed.
|
||||
- **Persistence**: `pipelines.next.chatFloat.v1` is stored device-locally and
|
||||
scoped like the workspace layout. It records the floating pane's id and
|
||||
session, whether it is shown, and the frame. It is restored after the
|
||||
workspace layout. A saved float whose session is already tiled is dropped.
|
||||
scoped like the workspace layout. Record version 2 holds the floating panes
|
||||
(id and session, oldest first, at most 12), whether they are shown, and a
|
||||
frame per pane id. A docked pane keeps its frame, so floating it again
|
||||
returns it to the same place; a closed pane's frame is dropped. Version 1
|
||||
records (one pane, one frame) still load. It is restored after the workspace
|
||||
layout. A saved float whose session is already open is dropped.
|
||||
|
||||
## Design
|
||||
|
||||
- `ChatWorkspaceController` keeps the floating pane outside the tree
|
||||
- `ChatWorkspaceController` keeps the floating panes outside the tree
|
||||
(`chat_workspace_float.dart`, a `part` with the `ChatWorkspaceFloat`
|
||||
extension). `panes` and `paneCount` stay tiled-only. The pane keeps its id
|
||||
through float, swap, hide and dock.
|
||||
- `ChatWorkspace` gives each pane's content a `GlobalKey`. The floating chat is
|
||||
extension: `floatingPanes`, `isFloating`, `dock(paneId)`, `restoreFloats`).
|
||||
`panes` and `paneCount` stay tiled-only. A pane keeps its id through float,
|
||||
hide and dock. Frames live in `ChatFloatFrames` (by pane id).
|
||||
- `ChatWorkspace` gives each pane's content a `GlobalKey`. A floating chat is
|
||||
that same keyed subtree, built by `ChatFloatHost` inside the workspace, so the
|
||||
`ChatThreadView` State, draft, scroll and running turn move with it and are
|
||||
not rebuilt. Its inherited context and focus tree stay in the workspace.
|
||||
@@ -65,12 +84,31 @@ shows or hides it.
|
||||
|
||||
## Not done
|
||||
|
||||
- The sidebar's "visible" highlight does not count the floating chat.
|
||||
- The sidebar's "visible" highlight does not count floating chats.
|
||||
- Floating windows need the Chat destination to have been built; the shell
|
||||
builds every destination up front, so this holds today.
|
||||
- Cmd+Y in a browser on macOS may be taken by the browser (History) before the
|
||||
app sees it. Ctrl+Y works there.
|
||||
|
||||
## Checks
|
||||
|
||||
### Multiple floats, every destination (2026-11-10)
|
||||
|
||||
- `tool/memwatch/full.sh 'test/features/chat/chat_floating_pane_test.dart test/features/chat/workspace test/ui/floating'`:
|
||||
93 passed, 0 failed. `tool/analyze.sh lib test/features/chat`: clean.
|
||||
- New tests: several floats toggled together by the chord and restored to
|
||||
their frames, docking one keeps the other (`chat_floating_pane_test.dart`);
|
||||
a float over another destination (a real `FadeThroughStack` page switch)
|
||||
is hit-testable, drags, takes focus and typing, and hides by chord and its
|
||||
X; controller, record v1/v2 and per-pane frame tests
|
||||
(`chat_workspace_float_test.dart`).
|
||||
- Fixed on the way: a drag read the frame from the last build, so several
|
||||
pointer events in one frame lost movement; and a never-moved window's
|
||||
cascaded frame shifted when another window docked (frames are now placed
|
||||
when a chat floats).
|
||||
|
||||
### Single float (earlier)
|
||||
|
||||
- `tool/analyze.sh lib test/features/chat test/ui test/features/terminal`: clean
|
||||
after the merge with main (pane moves, a410b9e5). In the merge, Float sits in
|
||||
the pane menu right after the Move items.
|
||||
|
||||
Reference in New Issue
Block a user