Description
truncateMiddle (packages/tui/src/util/locale.ts) returns the whole string — longer than the input — when maxLength is 1 or 2. At those widths keepEnd is 0, and str.slice(-0) slices from index 0 (returns everything) instead of nothing. The run splash detail line (splash.ts, which calls truncateMiddle(detail, Math.max(1, width - body_left))) can overflow on very narrow terminals.
Steps to reproduce
truncateMiddle("hello-world", 1) returns "…hello-world" (length 12) and truncateMiddle("hello-world", 2) returns "h…hello-world" (length 13). Expected "…" and "h…".
Description
truncateMiddle(packages/tui/src/util/locale.ts) returns the whole string — longer than the input — whenmaxLengthis 1 or 2. At those widthskeepEndis 0, andstr.slice(-0)slices from index 0 (returns everything) instead of nothing. The run splash detail line (splash.ts, which callstruncateMiddle(detail, Math.max(1, width - body_left))) can overflow on very narrow terminals.Steps to reproduce
truncateMiddle("hello-world", 1)returns"…hello-world"(length 12) andtruncateMiddle("hello-world", 2)returns"h…hello-world"(length 13). Expected"…"and"h…".