Summary
pi-powerline can render a footer/status line wider than the terminal, causing pi's TUI to crash with an uncaught render-width exception in narrow terminals.
Error
pi exiting due to uncaughtException:
Error: Rendered line 10422 exceeds terminal width (45 > 31).
This is likely caused by a custom TUI component not truncating its output.
Use visibleWidth() to measure and truncateToWidth() to truncate lines.
Debug log written to: /Users/davem/.pi/agent/pi-crash.log
at TUI.doRender (.../@earendil-works/pi-tui/dist/tui.js:1252:23)
A later crash log from a 27-column terminal showed the offending line:
Terminal width: 27
Line 2815 visible width: 45
[2815] (w=45) ─── ◈ pi / dm ──────────────────────────────
[2816] (w=27) ─ Kimi K2.7 Code / pi ─────
The over-wide line appears to be the powerline breadcrumb/status segment containing project/branch info (pi / dm) plus a fixed-width separator.
Expected behavior
All rendered lines should fit within the width passed to the component renderer. On narrow terminals, the statusline should truncate or drop segments rather than emitting a line wider than the terminal.
Actual behavior
A rendered footer line exceeded terminal width, and pi exited due to the TUI invariant violation.
Environment
- Package:
pi-powerline 0.8.0
- pi: 0.79.10
- Terminal width in crash log: 27 columns
- Model/session at time: Fireworks Kimi, branch
dm
Suggested fix
Ensure every rendered line uses pi-tui width helpers before returning:
visibleWidth() to measure rendered ANSI strings
truncateToWidth() or equivalent segment-dropping logic before return
For powerline-style bars, a robust approach is:
- reserve prompt/editor width first;
- render segments in priority order;
- drop low-priority segments as width shrinks;
- truncate the final segment/separator to the exact remaining width;
- assert every returned line is
<= width in tests, including widths under 30 columns.
Summary
pi-powerlinecan render a footer/status line wider than the terminal, causing pi's TUI to crash with an uncaught render-width exception in narrow terminals.Error
A later crash log from a 27-column terminal showed the offending line:
The over-wide line appears to be the powerline breadcrumb/status segment containing project/branch info (
pi / dm) plus a fixed-width separator.Expected behavior
All rendered lines should fit within the width passed to the component renderer. On narrow terminals, the statusline should truncate or drop segments rather than emitting a line wider than the terminal.
Actual behavior
A rendered footer line exceeded terminal width, and pi exited due to the TUI invariant violation.
Environment
pi-powerline0.8.0dmSuggested fix
Ensure every rendered line uses pi-tui width helpers before returning:
visibleWidth()to measure rendered ANSI stringstruncateToWidth()or equivalent segment-dropping logic before returnFor powerline-style bars, a robust approach is:
<= widthin tests, including widths under 30 columns.