Repository navigation
virtual rows: rows keep their sizes through inserts and removals; a layout asks only new rows - #68
Merged
Merged
Conversation
trissim
force-pushed
the
rows-keep-sizes
branch
from
November 18, 2026 19:22
e266243 to
08b2789
Compare
… layout asks only new rows Qt's list layout asks every row's size on each layout, and each ask built a style option and a preparation key: 28 us a row with the height already cached, 21 ms a layout at 1000 rows, and an appended row cost a reset's full measure (44 ms at 1000). On a phone at 120 Hz that is several frames per arrival (Tristan, Pixel 8a, bursts at 30 ms a frame, 2026-11-18). The delegate keeps each model row's size in a list aligned with the model's rows, for the font and width they were measured at. While a layout runs, a row answers from it. The view follows the model's inserts, removals and data changes, so rows that arrive start unmeasured and every other row keeps its size; a reset, move or layout change measures again. A row's new formatting (`_row_prepared`) drops its kept size; estimates away from the reader are kept as estimates until a slice measures them. Finding the reader no longer runs a pending layout inside the layout when the reader is at the end, and a layout that found its reader by running one stops there instead of laying the view out twice. Interpreter timings (offscreen, plain rows): full layout 20.7 -> 2.9 ms at 1000 rows, 6.0 ms at 2000; insert-append + layout 43.8 -> 3.3 ms at 1000. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim
force-pushed
the
rows-keep-sizes
branch
from
November 18, 2026 19:24
08b2789 to
38963f3
Compare
trissim
added a commit
to OpenHCSDev/toad
that referenced
this pull request
Nov 18, 2026
…ghts A row's kept height (OpenHCSDev/PyQT-reactive#68) answers without asking the row's key again, so a key that changes in place must be told. `request_show` changes a fragment's look in place (show sees the same object): the model now emits dataChanged for those rows, which drops their kept heights only, so each is measured again in its new look. A link or style change gives every row a new key: the delegate forgets every kept height. Live and draft rows are new fragment objects on each change, which show's identity comparison already tells as changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
trissim
added a commit
to OpenHCSDev/toad
that referenced
this pull request
Nov 18, 2026
… header, --open NAME, exact-match search, serve-tailnet restored (#2135) * qt sidebar and tabs: an observation redraws only what changed Qt's Sidebar.present redrew every channel and thread line on each bare present, which `present_sidebar` makes on every sidebar observation; the rows' changes already reach `sync` as partial ChangedChannels/ChangedThreads. On Tristan's phone during a burst of arrivals that redraw was 17% of the UI thread. A bare present now runs the shared state transition and keeps the status line current in place, as Textual's sidebar does; `sync` applies every change the state machine hands it: a partial one that keeps the channel order touches its rows, every other one (all rows, a channel added, removed or moved) draws the tree again in place. The search filter asks for all rows, as Textual's search follower re-syncs every group. The tab bar removed and re-added every tab on each paint_tabs, which the sidebar asked for on each observation (8.6% of the phone's UI thread). It now changes nothing when the tabs are the same, retitles only a changed title when the tabs and their order are the same (Textual's tab strip reconciles its labels so), and re-marks the selected tab only when the tabs or the selection changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * burst stack: a burst ends when the reader leaves the end, not when the offset falls The arrival drive's burst check found "the burst holds 0 messages of 5 posted" at phone speed: the burst grew to 8 messages while the window followed, then emptied with the window still following. Rows above that shrink (a receipt, the queue rows closing) make Qt clamp the scroll offset up outside `layout_scroll`, and `repin_header` ended the burst on any upward offset. A reader's own scroll up releases the anchor, so the burst now ends only once the window no longer follows the end. Shared: both frontends' windows pin through `PinsMessageHeader`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * qt history: a rising row fades as one picture, not its rich text drawn again each frame A burst's arrivals fade in row after row (`ArrivalFade`), and each frame of the fade drew every rising row's rich text again: its document's layout and every glyph, at the frame's opacity. Their look does not change while they rise, so the delegate draws a rising row once into a picture (by width, height, pixel ratio and document) and paints that at each frame's opacity; the picture goes when the row has risen or its fade lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * qt pin: a burst's stacked headers keep their layout as the stack shifts The pin laid out every header it draws again whenever the drawn set changed, and a burst's stack changes as each head glides past the top: each header's html built anew, its theme's colours resolved span by span. A phone-speed profile of a burst put that at a third of the UI thread (repin_header 31.9%, header_document 16.2%). The pin now keeps each header's document while its width, font, link context and renderer stay the same, and lays out only headers it has not. The renderer is part of that context, so a theme change lays the pin out again; before, an unchanged header set kept the old theme's document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * history rows: an arrival is an insert, not a reset; the composer reads its preview setting once per change The two largest per-frame costs left during a burst on the phone (busy main-thread time): every arrival reset the history model, so the view measured every row again (rows_changed / _update_viewport / sizeHint, ~23%), and each queue sync resolved the delivery-preview setting through the settings scope several times (~8%). HistoryRows.show now tells the view what changed. Rows of pages that did not change are the same fragment objects, so the unchanged rows before and after the change are found by identity, and only the rows between them are inserted, removed or changed (the changed rows keep their old content through the insert or removal and change in place after, as Qt's model contract requires; QAbstractItemModelTester in Fatal mode passes append, prepend, replaced live tail, arrivals before the draft, removal, mixed and full changes). With pyqt-reactive's kept row sizes (OpenHCSDev/PyQT-reactive#68) every unchanged row keeps its measured height. The row-key index is rebuilt only from the first changed row. show_pages and rows_changed lay out once and leave none pending (a model insert schedules Qt's own layout, which a direct doItemsLayout left to run a second time). PromptComposer keeps the delivery-preview setting as last read, until its change effect (apply_delivery_preview) drops it. Interpreter timings, offscreen: an append through HistoryRows into VirtualRowView, 1500 rows: 29-30 ms with the installed pyqt-reactive, 4.3-4.4 ms with #68 (main's reset path: 43.8 ms at 1000 rows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * qt tabs: marking the selected tab presents the panes on every paint again The batch gate's hold and menu_parity drives found the comms sidebar placed as a 24 px band at the bottom with the tab strip, where main places it at the left beside the conversation, so no sidebar row was on screen to press. paint_tabs had stopped calling mark_current when neither the tabs nor the selection changed, and mark_current is what presents the panes (`show_current_tab` -> `present_panes` -> each side bar's present and the chrome's arrange): the side bars stayed presented as before the drive's resize to phone width. paint_tabs marks the selected tab every time again, as on main; the bar itself still redraws only what changed. Checked with an offscreen interpreter run at 412x915 on main and this branch: the same 108 conversation rows, 12 inside the tree's viewport with no tab open, the same layout after #comms opens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * toad serve: add --public-url for tailnet-served browser workspaces The systemd unit bypassed ToadWebServer entirely with a raw python -c one-liner calling the unprotected base Server class. --tailnet-port never existed; the stale part was the unit's command. Add TailnetWebServer(Server) in web_server.py: same version check, no cookie gate (the tailnet's ACL is the access control), public_url passed through for correct WebSocket URL generation behind tailscale serve. The unit now uses `toad serve --public-url URL --port 8040 acp agent-comms-acp` instead of importing textual_serve directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: burst stack must not cover a visible header ArrivalBurst.stack() fired when pinned.headers was empty — the top row's own header divider was at the viewport's top, still visible in the flow. The stack drew "N new" + the earlier message's header at viewport y=0, covering the visible header with an identically-labelled one from the burst. Two "Agent" headers at the same pixels in a DM. Guard: return NO_STACK when pinned.headers is empty. The header is visible; there is nothing to stack on top of. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * history rows: a status change and a link change tell the kept row heights A row's kept height (OpenHCSDev/PyQT-reactive#68) answers without asking the row's key again, so a key that changes in place must be told. `request_show` changes a fragment's look in place (show sees the same object): the model now emits dataChanged for those rows, which drops their kept heights only, so each is measured again in its new look. A link or style change gives every row a new key: the delegate forgets every kept height. Live and draft rows are new fragment objects on each change, which show's identity comparison already tells as changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * toad + qt: --open NAME opens a thread or #channel at launch; search lists the exact name first One launch owner for both frontends: `ClientLaunch.startup` (local_connection) reads the Core (`select_connection`) and the conversation (`LaunchOpening.startup`, removing `--open NAME` as the connection's own options are removed) from the terminal launch's and Qt's desktop launch's arguments. The shared start (`ApplicationLifetime.start`) opens it after the saved tabs come back, through `TargetOpen`, as a sidebar row and a link naming it do. Sidebar search: `SidebarFilter.matching` is the one listing both frontends draw: matches ranked exact, then prefix, then the rest, each in model order. Textual's `TargetTree` kept its own copy of the match rule (`search` + `matches`); it now lists through its sidebar's filter, as Qt's channels tree and thread panel do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * history: a burst leaves the top row's own message out of its stack by identity The re-gate's arrival drive found one burst head above the top row and none stacked: burst messages from one sender to one destination in the same second draw equal headers, and `ArrivalBurst.stack` left out every message whose header equalled the top row's, so the earlier ones were dropped with it. `PinnedHeader` now carries the top row's message (its fragment key's source, from the shared `FragmentRowUnderTop` both front ends pin through) and the stack leaves out only that message. The drive's count does the same. The Qt pin sets its tap pass-through before its unchanged-drawing return: equal headers can stand for other messages, so the flag follows the stack, not the drawing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * qt_drive: a drive always keeps its settings under OUTDIR The isolation applied only when the shell held no XDG_CONFIG_HOME / XDG_STATE_HOME. A shell exporting XDG_CONFIG_HOME=~/.config gave the batch-4 gate's drives the reader's own toad.json: its ssh-origin layout docks both sidebars at the bottom, which left the hold drive's sidebar tree one line tall, so its holds and its tap landed on nothing (`held on []`, then "tapped row"). Their writes went to the real file too. Every gate script already names these same OUTDIR folders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 * toad serve-tailnet: port the owner-only tailnet serving from feat/toad-serve-tailnet The unmerged feat/toad-serve-tailnet branch (head 7ba3e21) carried owner-only tailnet serving behind tailscale serve: a TailnetBrowserEndpoint on a 0600 unix socket, TailnetBrowserAuthentication checking Tailscale-User-Login against the machine owner's login from tailscale status, and a ToadWebServer refactored to take any BrowserAuthentication. Port the architecture onto current main: - BrowserEndpoint ABC with LocalBrowserEndpoint and TailnetBrowserEndpoint - BrowserAuthentication ABC with Local and Tailnet siblings - ToadWebServer takes BrowserAuthentication; one class, two auth strategies - ToadWebServer.serve() overridden to listen on the endpoint's own socket - ProcessSingleton claims the tailnet lock so a second instance fails - OwnerOnlyDirectory verifies the runtime dir's ownership and mode The systemd unit now uses the installed toad command with no PYTHONPATH to a worktree: `toad serve-tailnet 8443 acp agent-comms-acp`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: burst stack covers visible header as the overlay's last line When B's header divider is the viewport's top row, pinned.headers is empty (the header is visible, no pin needed). The old code drew A's stacked header at y=0 on top of B's visible header — two Agent headers at the same pixels. The first attempt (returning NO_STACK when pinned is empty) killed the stack entirely, failing the drive's assertion that burst heads above the top row produce a visible stack. Fix: when pinned.headers is empty, find the burst message at the top row (reversed scan: message_top <= scroll_y). Its header becomes the overlay's last line (top_line) so the opaque overlay covers the flow's copy, and earlier messages stack above it. The overlay reads "N new / A / B" with B drawn once. The top-row header's key stays out of stacked.keys, so clicking it does nothing (the reader is already there). The overlay height = count + stacked + B_copy >= B_flow, so the flow's header is fully behind the opaque overlay in both Qt (WA_OpaquePaintEvent, sized to sum of doc heights at y=0) and Textual (dock=top, auto-height). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * serve-tailnet: use TailnetSelf from agent-comms instead of hand-parsing status TailnetBrowserAuthentication.from_status now calls TailnetBuses.this_machine() which returns a TailnetSelf(dns_name, owner_login) — the same tailscale status command and JSON parse that peer discovery already owns. Removes the subprocess import and raw dict-path reading that restated the status decode (IDEN-5: one fact, two stores). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * history: a header drawn at the top edge is the stack's last line; the opening placeholder is a Page - ArrivalBurst.stack: with nothing pinned, a header is drawn at the top edge (the top row is a message's head or the gap before it). The first burst message starting at or below the top edge is that header; it becomes the overlay's last line, drawn once, so no earlier header is drawn over it (gaming-a-headers' overlap). Traced on a 5-message burst: tops 60/73/86/99/112 with the furthest scroll at 103. - QtOpeningSessionView inherits Page: the window asks every open view for external_transcript_changed, and the placeholder shown while a thread opens had none (batch-6 hold drive: AttributeError on a CLI-transcript change). - Dropped the cloud test that compared identical-by-construction header labels and scrolled to a position the window cannot reach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Qt's list layout asks every row's
sizeHinton each layout. Each ask built aQStyleOptionViewItemand a preparation key: about 28 µs a row even when the height was cached. An appended row also cost a model reset's full re-measure. On a phone at 120 Hz that's several frames per arrival.Change
RowDocumentDelegatekeeps each model row's size in a list aligned with the model's rows, for the font and width they were measured at.begin_layout/end_layout, opened byVirtualRowView.doItemsLayout),sizeHintandmeasured_sizeanswer from it.VirtualRowView.setModelconnects the model's inserts, removals and data changes to the delegate, so arriving rows start unmeasured and every other row keeps its size. A reset, move or layout change measures again._row_prepareddrops a row's kept size when its formatting changes. Estimates away from the reader are kept, marked as estimates, until a slice measures them.reader_rowno longer callsindexAt, which ran a pending layout inside the layout. A layout that ran a pending one while finding its reader stops there.Timings (interpreter, offscreen, plain rows)
The log viewer's delegate keeps its own fixed-height
sizeHintand falls back to the base, and itsclear_cache→forget_rowsalso drops the kept sizes.🤖 Generated with Claude Code
https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3