@pi-archimedes/ui 2.11.0 → 2.11.1
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": "@pi-archimedes/ui",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "Terminal UI enhancements, styled bash tool rendering, and visual presentation components for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"./config": "./src/config.ts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pi-archimedes/core": "2.11.
|
|
31
|
+
"@pi-archimedes/core": "2.11.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@earendil-works/pi-ai": "1.2.0",
|
|
@@ -141,6 +141,13 @@ describe("TruncatedTextComponent", () => {
|
|
|
141
141
|
const comp = new TruncatedTextComponent("");
|
|
142
142
|
expect(comp.render(5)).toEqual([""]);
|
|
143
143
|
});
|
|
144
|
+
|
|
145
|
+
it("does not emit \\x1b[0m when truncated so an enclosing Box background is preserved", () => {
|
|
146
|
+
const comp = new TruncatedTextComponent("a".repeat(50));
|
|
147
|
+
const lines = comp.render(10);
|
|
148
|
+
expect(lines[0]!.includes("\x1b[0m")).toBe(false);
|
|
149
|
+
expect(lines[0]!.includes("\x1b[m")).toBe(false);
|
|
150
|
+
});
|
|
144
151
|
});
|
|
145
152
|
|
|
146
153
|
describe("renderBashCall", () => {
|
package/src/bash/renderer.ts
CHANGED
|
@@ -69,8 +69,11 @@ export class TruncatedTextComponent implements Component {
|
|
|
69
69
|
const singleLine = this.text.replace(/[\r\n]+/g, " ");
|
|
70
70
|
const ellipsis = this.theme ? this.theme.fg("accent", "…") : "…";
|
|
71
71
|
const truncated = truncateToWidth(singleLine, width, ellipsis);
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// truncateToWidth emits \x1b[0m, which resets the enclosing Box background mid-line.
|
|
73
|
+
// Downgrade full resets to fg/style resets so padding spaces keep the container background.
|
|
74
|
+
const safeTruncated = truncated.replace(/\x1b\[0?m/g, "\x1b[22;23;24;27;29;39m");
|
|
75
|
+
const padNeeded = Math.max(0, width - visibleWidth(safeTruncated));
|
|
76
|
+
return [safeTruncated + " ".repeat(padNeeded)];
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
|