@oh-my-pi/pi-tui 4.6.0 → 4.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-tui",
3
- "version": "4.6.0",
3
+ "version": "4.7.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",
@@ -136,10 +136,8 @@ export class Markdown implements Component {
136
136
  if (bgFn) {
137
137
  contentLines.push(applyBackgroundToLine(lineWithMargins, width, bgFn));
138
138
  } else {
139
- // No background - just pad to width
140
- const visibleLen = visibleWidth(lineWithMargins);
141
- const paddingNeeded = Math.max(0, width - visibleLen);
142
- contentLines.push(lineWithMargins + " ".repeat(paddingNeeded));
139
+ // No background - don't pad (avoids trailing spaces when copying)
140
+ contentLines.push(lineWithMargins);
143
141
  }
144
142
  }
145
143
 
@@ -1,5 +1,5 @@
1
1
  import type { Component } from "../tui";
2
- import { applyBackgroundToLine, visibleWidth, wrapTextWithAnsi } from "../utils";
2
+ import { applyBackgroundToLine, wrapTextWithAnsi } from "../utils";
3
3
 
4
4
  /**
5
5
  * Text component - displays multi-line text with word wrapping
@@ -83,10 +83,8 @@ export class Text implements Component {
83
83
  if (this.customBgFn) {
84
84
  contentLines.push(applyBackgroundToLine(lineWithMargins, width, this.customBgFn));
85
85
  } else {
86
- // No background - just pad to width with spaces
87
- const visibleLen = visibleWidth(lineWithMargins);
88
- const paddingNeeded = Math.max(0, width - visibleLen);
89
- contentLines.push(lineWithMargins + " ".repeat(paddingNeeded));
86
+ // No background - don't pad (avoids trailing spaces when copying)
87
+ contentLines.push(lineWithMargins);
90
88
  }
91
89
  }
92
90
 
@@ -1,5 +1,5 @@
1
1
  import type { Component } from "../tui";
2
- import { truncateToWidth, visibleWidth } from "../utils";
2
+ import { truncateToWidth } from "../utils";
3
3
 
4
4
  /**
5
5
  * Text component that truncates to fit viewport width
@@ -48,12 +48,8 @@ export class TruncatedText implements Component {
48
48
  const rightPadding = " ".repeat(this.paddingX);
49
49
  const lineWithPadding = leftPadding + displayText + rightPadding;
50
50
 
51
- // Pad line to exactly width characters
52
- const lineVisibleWidth = visibleWidth(lineWithPadding);
53
- const paddingNeeded = Math.max(0, width - lineVisibleWidth);
54
- const finalLine = lineWithPadding + " ".repeat(paddingNeeded);
55
-
56
- result.push(finalLine);
51
+ // Don't pad to full width - avoids trailing spaces when copying
52
+ result.push(lineWithPadding);
57
53
 
58
54
  // Add vertical padding below
59
55
  for (let i = 0; i < this.paddingY; i++) {