feat(live): rendered visualizer across entire container width

- Removed max width cap of 120 columns in LiveVisualizer.

- Added unit test to verify full width rendering for wider viewports.
This commit is contained in:
can1357
2026-07-24 09:28:42 +02:00
parent c36826cbac
commit 6ac5879858
2 changed files with 26 additions and 1 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ export class LiveVisualizer implements Component {
}
#renderLines(maxWidth: number): readonly string[] {
const width = Math.max(2, Math.min(maxWidth, 120));
const width = Math.max(2, maxWidth);
const innerWidth = width - 2;
const border = (content: string): string =>
theme.fg("border", "│") + content + (width > 1 ? theme.fg("border", "│") : "");
@@ -0,0 +1,25 @@
import { beforeAll, describe, expect, it } from "bun:test";
import { visibleWidth } from "@oh-my-pi/pi-tui";
import { LiveVisualizer } from "../src/live/visualizer";
import { initTheme } from "../src/modes/theme/theme";
describe("LiveVisualizer", () => {
beforeAll(async () => {
await initTheme(false);
});
it("renders across the entire provided width even when wider than 120 columns", () => {
const visualizer = new LiveVisualizer({
onStop: () => {},
onToggleMute: () => {},
});
for (const targetWidth of [80, 140, 200]) {
const lines = visualizer.render(targetWidth);
expect(lines.length).toBeGreaterThan(0);
for (const line of lines) {
expect(visibleWidth(line)).toBe(targetWidth);
}
}
});
});