Commit eda0085
authored
[2/4] TUI: bound clipped viewport painting (#14582)
## Description
Stack 2 of 4. Removes the full-height scratch buffer from `TuiClipped`
and paints children directly through a nested, buffer-enforced clip.
`TuiText` supplies 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:
- Many completed blocks, 10,000: 64.0 → 29.1 µs/frame (55% faster).
- Retained rich response, 1,000 rows: 2.30 → 0.925 ms (60% faster).
- Retained rich response, 10,000 rows: 24.5 → 8.56 ms (65% faster).
- Invalidated rich response, 10,000 rows: 25.7 → 9.38 ms (63% faster).
- Retained streaming tail at end, 10,000 rows: 33.9 → 17.2 ms (49%
faster).
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 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-IMPROVEMENT: Improved scrolling and typing performance for
long Warp Agent CLI transcripts.1 parent 53d770b commit eda0085
6 files changed
Lines changed: 273 additions & 49 deletions
File tree
- crates/warpui_core/src/elements/tui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
21 | 42 | | |
22 | 43 | | |
23 | 44 | | |
24 | 45 | | |
25 | 46 | | |
26 | 47 | | |
| 48 | + | |
27 | 49 | | |
28 | 50 | | |
29 | 51 | | |
30 | 52 | | |
31 | 53 | | |
32 | 54 | | |
| 55 | + | |
33 | 56 | | |
34 | 57 | | |
35 | 58 | | |
36 | 59 | | |
37 | 60 | | |
38 | 61 | | |
39 | 62 | | |
| 63 | + | |
40 | 64 | | |
41 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
42 | 87 | | |
43 | 88 | | |
44 | 89 | | |
| 90 | + | |
45 | 91 | | |
46 | 92 | | |
47 | 93 | | |
48 | 94 | | |
| 95 | + | |
49 | 96 | | |
50 | 97 | | |
51 | 98 | | |
52 | | - | |
53 | | - | |
| 99 | + | |
| 100 | + | |
54 | 101 | | |
55 | | - | |
56 | 102 | | |
57 | 103 | | |
| 104 | + | |
58 | 105 | | |
59 | | - | |
| 106 | + | |
60 | 107 | | |
61 | 108 | | |
62 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
63 | 124 | | |
64 | 125 | | |
65 | 126 | | |
66 | 127 | | |
67 | 128 | | |
68 | | - | |
| 129 | + | |
69 | 130 | | |
70 | 131 | | |
71 | | - | |
72 | 132 | | |
73 | 133 | | |
74 | 134 | | |
| |||
95 | 155 | | |
96 | 156 | | |
97 | 157 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
101 | 185 | | |
102 | 186 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
108 | 204 | | |
109 | 205 | | |
110 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
111 | 213 | | |
112 | 214 | | |
113 | 215 | | |
114 | 216 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 217 | + | |
119 | 218 | | |
120 | 219 | | |
121 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
11 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
124 | 123 | | |
125 | 124 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 125 | | |
134 | 126 | | |
135 | 127 | | |
136 | | - | |
137 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
138 | 131 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | 132 | | |
150 | 133 | | |
151 | 134 | | |
| |||
0 commit comments