Repository navigation
Conversation
Use rendered-element identity instead of bounds changes to detect reparenting. Keep new-participant and paint-order inversion recovery, and cover ancestor scrolling with and without a selection beside an unrelated retained TextView. AI-assisted implementation and regression validation.
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.
Fixes #3626
Description
Dragging a text selection on GPUI Fast updates the shared window-selection entity as each selectable text registers. Each registration republishes snapshots for all participants, producing quadratic frame work and invalidating unrelated retained views.
Record registrations through a read of the window entity, resolve the registering participant's own snapshot immediately, and publish changed snapshots once at the end of the frame. Keep automatic document order across partial redraws, recovering it with one full refresh when topology changes require it. Retire departed endpoints without resurrecting their selection when retained entities remount. Defer touch-edge and held-cursor updates until frame completion.
The code diff contains four Base files: 683 insertions and 235 deletions, including four retained-view regressions. Existing imports and public signatures remain available.
Following the previous contribution (#3673), Markdown reports, raw logs, fixtures, screenshots and reproduction instructions are preserved at an immutable commit on a separate fork evidence branch. Evidence files are not included in this code PR.
Before and after
The same retained-view regression fails before the fix: four pointer moves increase an unrelated view's render count from 4 to 8. It passes after the fix without additional unrelated renders.
Measured with the same real TextView fixture, GPUI Fast 0.1.10 and pointer path:
Linux x86_64 / Rust 1.98.0, repository dev profile including its GPUI optimization overrides. Each version/size has three trials, each with 10 warm-up and 60 recorded moves, for 180 samples. Timing covers input dispatch,
window.drawand deferred processing until parked. One pointer step can produce multiple draws. Screenshot readback, GPU completion and display presentation are excluded; these are not FPS or the macOS frame timings from the issue.Screenshot
Same 64-TextView fixture and selection endpoint, captured using GPUI's real GPU offscreen renderer. The files are byte-identical: the selection appearance is preserved while the render counts and CPU work change.
Separate actual desktop-window screenshots and acceptance records cover forward/reverse cross-text selection, system clipboard copying, selection handles and edit-menu Copy, native Wayland scrolling, and endpoint removal/remount. Native mouse/keyboard input used the authorized KDE RemoteDesktop EIS interface; screenshots were captured with Spectacle.
Touch-selection UI was exercised through the demo's
Long pressbutton and pointer handle dragging. Physical touchscreen input, macOS and Windows were not verified. Full details, including unsuccessful input attempts, are recorded in the evidence.Public API
gpui-base
Existing signatures with changed internal publication/lifecycle behavior:
The existing hidden method remains callable as a compatibility no-op; automatic TextView order is now maintained by window-local selection state.
Registers participant geometry and resolves its own snapshot immediately; shared frame publication and paint-driven selection notifications are deferred until frame completion.
Breaking Changes
No public signatures or imports are removed. Existing-method behavior changes are recorded here as required by CONTRIBUTING:
Consumers must not depend on registration publishing other participants or delivering paint-driven selection events before frame completion.
How to Test
Validated against baseline
7b14e03f2ed4b46fc4149a8a523c7f91bcad6560plus code commit9b42fb299a50610d83c5fb484cf4db390871ac28:The Fast selection filter reports 56 passed, the regular GPUI filter 53 passed, and Kit's selection integration filter 78 passed. Base Fast library Clippy, formatting and the code diff check passed.
The new regressions cover unrelated retained views, linear snapshot visits, selected-text scrolling without order rebuilds, and partial-frame order through insertion, reordering, endpoint removal and remounting.
The complete Base Fast suite was also compared:
cargo test -p gpui-base --features gpui-fast,test-support --lib --lockedBoth native
text_selectionandtouch_selectionexamples were built with GPUI Fast and exercised on Linux. Forward/reverse clipboard contents match exactly. Native Wayland scrolling preserves the selected text and moves the handles with it. Removing a selected endpoint changeshas_selectionto false; remounting the retained endpoint keeps it false. The full Story Gallery was not run.The evidence branch includes
reproduce.pyfor rebuilding the expected baseline failure/fixed success and optionally the GPU fixture. The script was syntax-checked during publication; its complete rebuild was not rerun. The archived executions are the measured evidence.AI Assistance
AI assisted with patch analysis, line-by-line review, regression validation, CPU/render-count measurements, native-window acceptance, bilingual Markdown evidence, and commit/PR preparation. The production fix and added regressions originated in the supplied patch. Human maintainer review remains required.
Checklist