Commit 0a6a845
Yogthos
ui: center chat content + wrap to chamber width
Two parts working together:
## Wrap chat messages to chamber width
Markdown rendering for assistant messages and the live token
stream used `renderer.line_width()` (the full content band), so
long replies spilled across the entire terminal even when the
tool chambers below them were capped at 120 cols. Result: chat
text was visually a different width from chambers — the eye saw
two parallel layouts.
Both render paths now wrap to `renderer.content_width()` minus the
8-col chat handle prefix (`<dirge> ` + space), so wrapped lines
sit beneath the handle and the right edge matches chamber width.
## Center the chat band
The whole chat content area (chamber tops/bottoms, chat lines,
banner, prompt input row, status row, cursor) now indents by
`content_indent()` columns to center within the visible chat band.
On a 160-col terminal with the panel visible:
- band width = 160 - 33 (panel) - 1 (divider gutter) = 126 cols
- target content width = min(126, 120) = 120 cols
- indent = (126 - 120) / 2 = 3 cols
So the chat sits in a 120-col column with ~3 cols of margin each
side, regardless of how wide the terminal is. On a 100-col
terminal the indent is 0 — the chat uses the full band.
Two new helpers on `Renderer`:
- `content_width() -> usize` — cap at 120 cols.
- `content_indent() -> usize` — left padding to center within the
band.
`render_viewport` applies the indent at paint time so the buffer
itself stays raw (no rewrites needed when terminal width changes).
The bottom rows (input + status + cursor) match.
## Test plan
- [x] `cargo test --features plugin` -> 599 pass, 0 fail.
- [x] Both build profiles -> 0 warnings.
- [ ] Eyeball: on a wide terminal, verify chat + chambers share
the same 120-col column and both visibly center under the
chat band; verify cursor lands where text is being typed;
verify status line + prompt align with chat above.1 parent 7e91302 commit 0a6a845
3 files changed
Lines changed: 55 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
85 | 91 | | |
86 | 92 | | |
87 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1412 | 1412 | | |
1413 | 1413 | | |
1414 | 1414 | | |
1415 | | - | |
| 1415 | + | |
1416 | 1416 | | |
1417 | 1417 | | |
1418 | 1418 | | |
| |||
1603 | 1603 | | |
1604 | 1604 | | |
1605 | 1605 | | |
1606 | | - | |
| 1606 | + | |
1607 | 1607 | | |
1608 | 1608 | | |
1609 | 1609 | | |
| |||
1812 | 1812 | | |
1813 | 1813 | | |
1814 | 1814 | | |
1815 | | - | |
| 1815 | + | |
1816 | 1816 | | |
1817 | 1817 | | |
1818 | 1818 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
160 | 176 | | |
161 | 177 | | |
162 | 178 | | |
| |||
373 | 389 | | |
374 | 390 | | |
375 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
376 | 398 | | |
377 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
378 | 405 | | |
379 | 406 | | |
380 | 407 | | |
381 | | - | |
| 408 | + | |
382 | 409 | | |
383 | 410 | | |
384 | 411 | | |
| |||
420 | 447 | | |
421 | 448 | | |
422 | 449 | | |
423 | | - | |
424 | | - | |
425 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
426 | 456 | | |
427 | 457 | | |
428 | 458 | | |
| |||
728 | 758 | | |
729 | 759 | | |
730 | 760 | | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
731 | 765 | | |
732 | 766 | | |
733 | 767 | | |
734 | 768 | | |
735 | 769 | | |
736 | | - | |
| 770 | + | |
737 | 771 | | |
738 | 772 | | |
739 | 773 | | |
| |||
763 | 797 | | |
764 | 798 | | |
765 | 799 | | |
766 | | - | |
| 800 | + | |
767 | 801 | | |
768 | 802 | | |
769 | | - | |
| 803 | + | |
770 | 804 | | |
771 | 805 | | |
772 | 806 | | |
| |||
803 | 837 | | |
804 | 838 | | |
805 | 839 | | |
806 | | - | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
807 | 844 | | |
808 | 845 | | |
809 | 846 | | |
| |||
0 commit comments