[2/4] TUI: bound clipped viewport painting - #14582
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR replaces TuiClipped's full-height scratch buffer with direct painting through a clipped TuiPaintSurface, and updates TuiText to pass a vertical row offset into ratatui paragraph rendering. The overall direction is performance-focused and the diff includes focused TUI buffer/clipping regression coverage.
Concerns
render_vertically_scrollable_widgetfails closed when the widget bounds are partially clipped horizontally, which can drop visible text instead of enforcing the visible intersection promised by the new clip surface.- No material security findings were identified.
spec_context.mdcontains no approved or repository spec context, so there was no material spec drift to enforce.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
cb13209 to
ec59dc4
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ec59dc4 to
e424b6e
Compare
e424b6e to
2695304
Compare
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR updates TUI painting so clipped viewports write directly through a nested buffer-enforced clip, adds visible-window rendering for Paragraph widgets, and adjusts TuiClipped/TuiText to use that path. The added TUI to_lines regression coverage exercises visible rows/columns, nested clipping, negative bounds, and retained clipped content.
Concerns
- No blocking correctness, security, or spec-alignment concerns found in the annotated diff. The provided spec context says no approved or repository spec context was found.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
## Description Stack 3 of 4. Reuses `TuiText` natural measurements when retained content is laid out again at the same width, and avoids copying a viewport selection snapshot when there is no active selection and line-end trimming is disabled. This layer targets steady-state frame overhead after stack PR 2 has already bounded paint work. Width changes still recompute text measurement, and selection snapshots remain enabled whenever selection or trimmed line-end behavior needs them. Benchmark at 120×50 versus stack PR 2: - Retained rich response, 1,000 rows: 0.925 → 0.129 ms (86% faster). - Retained rich response, 10,000 rows: 8.56 → 0.598 ms (93% faster). - Retained middle frame, 10,000 rows: 8.41 → 0.395 ms (95% faster). - Retained streaming tail at end, 10,000 rows: 17.2 → 9.88 ms (42% faster). - Invalidated rich response, 10,000 rows: 9.38 → 9.85 ms (~5% slower). - Many completed blocks, 10,000: 29.2 → 31.6 µs/frame (~8% slower, still flat with history depth). The next stack layer removes the remaining repeated streaming-height work and owns auto-scroll reconciliation. Stack: #14575 ← #14582 ← **3/4** → `oz/tui-streaming-height-reconciliation`. Agent conversation: https://staging.warp.dev/conversation/2b6af7be-b227-4b20-aaf4-23c9a8494b81 Stack plan: https://staging.warp.dev/drive/notebook/yM2YcQsILFsFzwixBDbD9p Performance plan: https://staging.warp.dev/drive/notebook/LHzsFd1B8XbQ8AnUqB88LS ## Linked Issue N/A — Warp Agent CLI retained-frame performance. ## Testing - `cargo nextest run -p warpui_core --features tui` — 555 passed, 7 skipped. - `cargo nextest run -p warp_tui` — 902 passed. - Strict Clippy passed for `warpui_core --features tui` and `warp_tui --features test-util`. - `cargo bench -p warp_tui --features test-util --bench transcript_bench` - `./script/format` - Signed-in 120×40 tmux PTY: zero state and unsent input repainted correctly. - [x] I have manually tested my changes locally with `./script/run-tui` ## Agent Mode - [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode CHANGELOG-NONE

Description
Stack 2 of 4. Removes the full-height scratch buffer from
TuiClippedand paints children directly through a nested, buffer-enforced clip.TuiTextsupplies the logical row offset to ratatui so only the visible paragraph window is painted.The clip is enforced for cell, style, and widget writes; it is not only scene/hit-test metadata. Regression coverage includes nested clipping, translated rows, negative bounds, cursor visibility, and a retained long child that must not overwrite simulated input/footer rows.
Benchmark at 120×50 versus stack PR 1:
Stack: #14575 ← 2/4 →
oz/tui-retained-frame-overhead→oz/tui-streaming-height-reconciliation.Agent conversation: https://staging.warp.dev/conversation/2b6af7be-b227-4b20-aaf4-23c9a8494b81
Stack plan: https://staging.warp.dev/drive/notebook/yM2YcQsILFsFzwixBDbD9p
Performance plan: https://staging.warp.dev/drive/notebook/LHzsFd1B8XbQ8AnUqB88LS
Linked Issue
N/A — Warp Agent CLI transcript rendering performance.
Testing
cargo nextest run -p warpui_core --features tui— 555 passed, 7 skipped.cargo nextest run -p warp_tui— 902 passed.Strict Clippy passed for
warpui_core --features tuiandwarp_tui --features test-util.cargo bench -p warp_tui --features test-util --bench transcript_bench./script/formatSigned-in 120×40 tmux PTY: zero state and unsent input repainted correctly.
I have manually tested my changes locally with
./script/run-tuiAgent Mode
CHANGELOG-IMPROVEMENT: Improved scrolling and typing performance for long Warp Agent CLI transcripts.