Commit 4018f4e
Yogthos
ui: closed pills, opencode-style diff bg, fix mouse-report leak
Address every issue from the visual review:
## Closed pills (panel + tool chambers)
Every framed region now closes properly on the right + bottom:
- **Panel sections**: `╭─ MCP ─────╮` ... `│ items │` ...
`╰───────────╯`. The right border + bottom border were missing
before; sections felt unfinished. Each item row pads to the
panel's inner width so the right `│` aligns vertically.
- **Tool chambers**: top `╭─ READ ─ /path ──────────╮` extends
with dashes out to the frame width, content rows `│ line │`
pad/truncate to fit, bottom `╰────────╯` matches.
- Chamber inner content longer than the frame is truncated with
`…` instead of soft-wrapping out of the box. Frame width caps at
120 cols so wide terminals don't sprawl.
Two helpers carry the logic: `chamber_widths(renderer)` returns
`(frame_w, inner)` based on `renderer.line_width().min(120)`;
`chamber_row(content, inner)` produces a single `│ ... │` row.
Tool-call header, normal output, edit diffs, and truncation
markers all route through the same helpers.
## Opencode-style diff backgrounds
The edit-tool diff renderer now matches opencode's tinted-bg
approach (`tint(bg, green, 0.15)` etc.):
- `+` lines: background palette 22 (dim green) across the inner
chamber width, fg bright green.
- `-` lines: background palette 52 (dim red), fg bright red.
- `--- ` / `+++ ` header lines: no bg, fg cyan.
- `@@` hunk markers: no bg, fg dark cyan.
- Context lines: no bg, fg dim phosphor.
Backgrounds embed raw SGR escapes (`\x1b[48;5;Nm…\x1b[49m`) inside
the row so the chamber's left/right borders stay in their normal
color while the diff tint fills the inner width. New
`chamber_row_with_bg(content, inner, bg_idx)` helper.
## Color fixes
- **User input text** (what the user types into the input box) is
now rendered in `theme::user()` (bright green) instead of the
terminal's default tone, which read as off-white/grey.
- **Assistant reply body** (markdown-rendered prose) now uses
`theme::agent()` (bright green) instead of `Color::White`.
All 13 `Color::White` references in `src/ui/markdown.rs` swept
to `theme::agent()`; under `plain` theme the helper resolves
back to White so the legacy look is preserved.
## Defensive mouse-report sanitization
Bug from the screenshot where `[<65;79;32M[<65;79;32M…` smeared
across tool output. SGR mouse reports (`\x1b[<btn;col;row(M|m)`)
were leaking into the rendered text without their leading `\x1b`
— most likely from a shell command in the agent's bash tool
capturing terminal input bytes.
`sanitize_output` now runs a pre-pass (`strip_orphan_mouse_reports`)
that walks the text matching `[<digits;digits;digits(M|m)` and
drops matched runs. Genuine `[` characters that don't start a
mouse-report pattern pass through unchanged.
## Test plan
- [x] `cargo test --features plugin` -> 599 pass, 0 fail.
- [x] Both build profiles -> 0 warnings.
- [ ] Eyeball: panel sections render as closed cards, tool
chambers close on both sides, diff `+`/`-` lines show
tinted bg strips, no `[<…M` smear in tool output.1 parent 91e9b4c commit 4018f4e
4 files changed
Lines changed: 239 additions & 77 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
199 | 207 | | |
200 | 208 | | |
201 | 209 | | |
| |||
217 | 225 | | |
218 | 226 | | |
219 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
| 228 | + | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1440 | 1440 | | |
1441 | 1441 | | |
1442 | 1442 | | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
1447 | 1450 | | |
1448 | 1451 | | |
1449 | 1452 | | |
1450 | 1453 | | |
1451 | 1454 | | |
1452 | | - | |
1453 | | - | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1454 | 1464 | | |
1455 | 1465 | | |
1456 | 1466 | | |
| |||
1480 | 1490 | | |
1481 | 1491 | | |
1482 | 1492 | | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
1486 | 1497 | | |
1487 | 1498 | | |
| 1499 | + | |
1488 | 1500 | | |
1489 | | - | |
| 1501 | + | |
1490 | 1502 | | |
1491 | 1503 | | |
1492 | 1504 | | |
1493 | 1505 | | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1497 | 1512 | | |
1498 | | - | |
1499 | | - | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
1500 | 1519 | | |
1501 | | - | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
1502 | 1524 | | |
1503 | | - | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
1504 | 1529 | | |
1505 | | - | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
1506 | 1534 | | |
1507 | | - | |
1508 | | - | |
1509 | | - | |
1510 | | - | |
1511 | | - | |
1512 | | - | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1513 | 1540 | | |
1514 | | - | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
1515 | 1545 | | |
1516 | 1546 | | |
1517 | 1547 | | |
| |||
2610 | 2640 | | |
2611 | 2641 | | |
2612 | 2642 | | |
2613 | | - | |
2614 | | - | |
2615 | | - | |
2616 | | - | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
2617 | 2650 | | |
2618 | | - | |
| 2651 | + | |
2619 | 2652 | | |
2620 | 2653 | | |
2621 | 2654 | | |
2622 | | - | |
| 2655 | + | |
| 2656 | + | |
2623 | 2657 | | |
2624 | | - | |
| 2658 | + | |
2625 | 2659 | | |
2626 | 2660 | | |
2627 | 2661 | | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
| 2677 | + | |
| 2678 | + | |
| 2679 | + | |
| 2680 | + | |
| 2681 | + | |
| 2682 | + | |
| 2683 | + | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
2628 | 2722 | | |
2629 | 2723 | | |
2630 | 2724 | | |
| |||
0 commit comments