@oh-my-pi/pi-tui 3.30.0 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils.ts +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-tui",
3
- "version": "3.30.0",
3
+ "version": "3.32.0",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/utils.ts CHANGED
@@ -474,6 +474,18 @@ function wrapSingleLine(line: string, width: number): string[] {
474
474
  const isWhitespace = token.trim() === "";
475
475
 
476
476
  // Token itself is too long - break it character by character
477
+ // For whitespace tokens exceeding width, truncate to width instead of breaking
478
+ if (tokenVisibleLength > width && isWhitespace) {
479
+ // Truncate long whitespace to fit width
480
+ const truncated = token.substring(0, width - currentVisibleLength);
481
+ if (truncated) {
482
+ currentLine += truncated;
483
+ currentVisibleLength += visibleWidth(truncated);
484
+ }
485
+ updateTrackerFromText(token, tracker);
486
+ continue;
487
+ }
488
+
477
489
  if (tokenVisibleLength > width && !isWhitespace) {
478
490
  if (currentLine) {
479
491
  // Add specific reset for underline only (preserves background)