@oh-my-pi/pi-tui 5.3.0 → 5.3.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 +1 -1
- package/src/tui.ts +13 -0
package/package.json
CHANGED
package/src/tui.ts
CHANGED
|
@@ -198,6 +198,7 @@ export class TUI extends Container {
|
|
|
198
198
|
/** Global callback for debug key (Shift+Ctrl+D). Called before input is forwarded to focused component. */
|
|
199
199
|
public onDebug?: () => void;
|
|
200
200
|
private renderRequested = false;
|
|
201
|
+
private rendering = false;
|
|
201
202
|
private cursorRow = 0; // Track where cursor is (0-indexed, relative to our first line)
|
|
202
203
|
private previousCursor: { row: number; col: number } | null = null;
|
|
203
204
|
private inputBuffer = ""; // Buffer for parsing terminal responses
|
|
@@ -777,6 +778,18 @@ export class TUI extends Container {
|
|
|
777
778
|
}
|
|
778
779
|
|
|
779
780
|
private doRender(): void {
|
|
781
|
+
// Guard against re-entrant renders (can happen on Windows when Bun.spawnSync
|
|
782
|
+
// yields to the event loop during a sync subprocess call)
|
|
783
|
+
if (this.rendering) return;
|
|
784
|
+
this.rendering = true;
|
|
785
|
+
try {
|
|
786
|
+
this.doRenderImpl();
|
|
787
|
+
} finally {
|
|
788
|
+
this.rendering = false;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
private doRenderImpl(): void {
|
|
780
793
|
// Capture terminal dimensions at start to ensure consistency throughout render
|
|
781
794
|
const width = this.terminal.columns;
|
|
782
795
|
const height = this.terminal.rows;
|