linecraft 0.1.0 → 0.2.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/LICENSE +1 -1
- package/README.md +313 -64
- package/lib/api/color.d.ts +6 -0
- package/lib/api/color.d.ts.map +1 -0
- package/lib/api/color.js +9 -0
- package/lib/api/color.js.map +1 -0
- package/lib/api/color.test.d.ts +2 -0
- package/lib/api/color.test.d.ts.map +1 -0
- package/lib/api/color.test.js +23 -0
- package/lib/api/color.test.js.map +1 -0
- package/lib/api/flex.d.ts +55 -0
- package/lib/api/flex.d.ts.map +1 -0
- package/lib/api/flex.js +86 -0
- package/lib/api/flex.js.map +1 -0
- package/lib/api/flex.test.d.ts +2 -0
- package/lib/api/flex.test.d.ts.map +1 -0
- package/lib/api/flex.test.js +82 -0
- package/lib/api/flex.test.js.map +1 -0
- package/lib/api/grid.d.ts +22 -0
- package/lib/api/grid.d.ts.map +1 -0
- package/lib/api/grid.js +65 -0
- package/lib/api/grid.js.map +1 -0
- package/lib/api/grid.test.d.ts +2 -0
- package/lib/api/grid.test.d.ts.map +1 -0
- package/lib/api/grid.test.js +48 -0
- package/lib/api/grid.test.js.map +1 -0
- package/lib/components/base.d.ts +53 -0
- package/lib/components/base.d.ts.map +1 -0
- package/lib/components/base.js +47 -0
- package/lib/components/base.js.map +1 -0
- package/lib/components/col.d.ts +35 -0
- package/lib/components/col.d.ts.map +1 -0
- package/lib/components/col.js +168 -0
- package/lib/components/col.js.map +1 -0
- package/lib/components/col.test.d.ts +2 -0
- package/lib/components/col.test.d.ts.map +1 -0
- package/lib/components/col.test.js +96 -0
- package/lib/components/col.test.js.map +1 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +5 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/progress-bar-grid.d.ts +20 -0
- package/lib/components/progress-bar-grid.d.ts.map +1 -0
- package/lib/components/progress-bar-grid.js +44 -0
- package/lib/components/progress-bar-grid.js.map +1 -0
- package/lib/components/progress-bar-grid.test.d.ts +2 -0
- package/lib/components/progress-bar-grid.test.d.ts.map +1 -0
- package/lib/components/progress-bar-grid.test.js +101 -0
- package/lib/components/progress-bar-grid.test.js.map +1 -0
- package/lib/components/progress-bar.d.ts +26 -3
- package/lib/components/progress-bar.d.ts.map +1 -1
- package/lib/components/progress-bar.js +62 -6
- package/lib/components/progress-bar.js.map +1 -1
- package/lib/components/progress-bar.test.d.ts +2 -0
- package/lib/components/progress-bar.test.d.ts.map +1 -0
- package/lib/components/progress-bar.test.js +153 -0
- package/lib/components/progress-bar.test.js.map +1 -0
- package/lib/components/prompt.d.ts +14 -0
- package/lib/components/prompt.d.ts.map +1 -0
- package/lib/components/prompt.js +77 -0
- package/lib/components/prompt.js.map +1 -0
- package/lib/components/renderable.d.ts +42 -0
- package/lib/components/renderable.d.ts.map +1 -0
- package/lib/components/renderable.js +225 -0
- package/lib/components/renderable.js.map +1 -0
- package/lib/components/spinner.d.ts +2 -2
- package/lib/components/spinner.d.ts.map +1 -1
- package/lib/components/spinner.js +3 -1
- package/lib/components/spinner.js.map +1 -1
- package/lib/components/spinner.test.d.ts +2 -0
- package/lib/components/spinner.test.d.ts.map +1 -0
- package/lib/components/spinner.test.js +168 -0
- package/lib/components/spinner.test.js.map +1 -0
- package/lib/components/style.d.ts +16 -0
- package/lib/components/style.d.ts.map +1 -0
- package/lib/components/style.js +72 -0
- package/lib/components/style.js.map +1 -0
- package/lib/components/style.test.d.ts +2 -0
- package/lib/components/style.test.d.ts.map +1 -0
- package/lib/components/style.test.js +135 -0
- package/lib/components/style.test.js.map +1 -0
- package/lib/components/text.d.ts +24 -0
- package/lib/components/text.d.ts.map +1 -0
- package/lib/components/text.js +65 -0
- package/lib/components/text.js.map +1 -0
- package/lib/drawing/boxes.d.ts +33 -0
- package/lib/drawing/boxes.d.ts.map +1 -0
- package/lib/drawing/boxes.js +76 -0
- package/lib/drawing/boxes.js.map +1 -0
- package/lib/index.d.ts +18 -11
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +21 -10
- package/lib/index.js.map +1 -1
- package/lib/index.test.d.ts +2 -0
- package/lib/index.test.d.ts.map +1 -0
- package/lib/index.test.js +80 -0
- package/lib/index.test.js.map +1 -0
- package/lib/layout/flex.d.ts +39 -0
- package/lib/layout/flex.d.ts.map +1 -0
- package/lib/layout/flex.js +300 -0
- package/lib/layout/flex.js.map +1 -0
- package/lib/layout/flex.test.d.ts +2 -0
- package/lib/layout/flex.test.d.ts.map +1 -0
- package/lib/layout/flex.test.js +206 -0
- package/lib/layout/flex.test.js.map +1 -0
- package/lib/layout/grid.d.ts +53 -0
- package/lib/layout/grid.d.ts.map +1 -0
- package/lib/layout/grid.js +421 -0
- package/lib/layout/grid.js.map +1 -0
- package/lib/layout/grid.test.d.ts +2 -0
- package/lib/layout/grid.test.d.ts.map +1 -0
- package/lib/layout/grid.test.js +139 -0
- package/lib/layout/grid.test.js.map +1 -0
- package/lib/native/ansi.d.ts +104 -0
- package/lib/native/ansi.d.ts.map +1 -0
- package/lib/native/ansi.js +120 -0
- package/lib/native/ansi.js.map +1 -0
- package/lib/native/ansi.test.d.ts +2 -0
- package/lib/native/ansi.test.d.ts.map +1 -0
- package/lib/native/ansi.test.js +57 -0
- package/lib/native/ansi.test.js.map +1 -0
- package/lib/native/buffer.d.ts +32 -0
- package/lib/native/buffer.d.ts.map +1 -0
- package/lib/native/buffer.js +49 -0
- package/lib/native/buffer.js.map +1 -0
- package/lib/native/buffer.test.d.ts +2 -0
- package/lib/native/buffer.test.d.ts.map +1 -0
- package/lib/native/buffer.test.js +64 -0
- package/lib/native/buffer.test.js.map +1 -0
- package/lib/native/diff.d.ts +20 -0
- package/lib/native/diff.d.ts.map +1 -0
- package/lib/native/diff.js +33 -0
- package/lib/native/diff.js.map +1 -0
- package/lib/native/diff.test.d.ts +2 -0
- package/lib/native/diff.test.d.ts.map +1 -0
- package/lib/native/diff.test.js +106 -0
- package/lib/native/diff.test.js.map +1 -0
- package/lib/native/region-old.d.ts +117 -0
- package/lib/native/region-old.d.ts.map +1 -0
- package/lib/native/region-old.js +539 -0
- package/lib/native/region-old.js.map +1 -0
- package/lib/native/region-renderer.d.ts +167 -0
- package/lib/native/region-renderer.d.ts.map +1 -0
- package/lib/native/region-renderer.js +1238 -0
- package/lib/native/region-renderer.js.map +1 -0
- package/lib/native/region-simple.d.ts +44 -0
- package/lib/native/region-simple.d.ts.map +1 -0
- package/lib/native/region-simple.js +290 -0
- package/lib/native/region-simple.js.map +1 -0
- package/lib/native/region.d.ts +53 -0
- package/lib/native/region.d.ts.map +1 -0
- package/lib/native/region.js +426 -0
- package/lib/native/region.js.map +1 -0
- package/lib/native/region.test.d.ts +2 -0
- package/lib/native/region.test.d.ts.map +1 -0
- package/lib/native/region.test.js +248 -0
- package/lib/native/region.test.js.map +1 -0
- package/lib/native/throttle.d.ts +29 -0
- package/lib/native/throttle.d.ts.map +1 -0
- package/lib/native/throttle.js +57 -0
- package/lib/native/throttle.js.map +1 -0
- package/lib/native/throttle.test.d.ts +2 -0
- package/lib/native/throttle.test.d.ts.map +1 -0
- package/lib/native/throttle.test.js +86 -0
- package/lib/native/throttle.test.js.map +1 -0
- package/lib/native.d.ts +5 -11
- package/lib/native.d.ts.map +1 -1
- package/lib/native.js +8 -64
- package/lib/native.js.map +1 -1
- package/lib/region.d.ts +48 -5
- package/lib/region.d.ts.map +1 -1
- package/lib/region.js +474 -36
- package/lib/region.js.map +1 -1
- package/lib/region.test.d.ts +2 -0
- package/lib/region.test.d.ts.map +1 -0
- package/lib/region.test.js +227 -0
- package/lib/region.test.js.map +1 -0
- package/lib/region.visual.test.d.ts +2 -0
- package/lib/region.visual.test.d.ts.map +1 -0
- package/lib/region.visual.test.js +55 -0
- package/lib/region.visual.test.js.map +1 -0
- package/lib/test-helpers/capturable-terminal.d.ts +61 -0
- package/lib/test-helpers/capturable-terminal.d.ts.map +1 -0
- package/lib/test-helpers/capturable-terminal.js +113 -0
- package/lib/test-helpers/capturable-terminal.js.map +1 -0
- package/lib/test-helpers/capturable-terminal.test.d.ts +2 -0
- package/lib/test-helpers/capturable-terminal.test.d.ts.map +1 -0
- package/lib/test-helpers/capturable-terminal.test.js +45 -0
- package/lib/test-helpers/capturable-terminal.test.js.map +1 -0
- package/lib/test-helpers/mock-region.d.ts +21 -0
- package/lib/test-helpers/mock-region.d.ts.map +1 -0
- package/lib/test-helpers/mock-region.js +37 -0
- package/lib/test-helpers/mock-region.js.map +1 -0
- package/lib/test-helpers/virtual-terminal-diff-reflow.test.d.ts +2 -0
- package/lib/test-helpers/virtual-terminal-diff-reflow.test.d.ts.map +1 -0
- package/lib/test-helpers/virtual-terminal-diff-reflow.test.js +256 -0
- package/lib/test-helpers/virtual-terminal-diff-reflow.test.js.map +1 -0
- package/lib/test-helpers/virtual-terminal-flex-resize.test.d.ts +2 -0
- package/lib/test-helpers/virtual-terminal-flex-resize.test.d.ts.map +1 -0
- package/lib/test-helpers/virtual-terminal-flex-resize.test.js +438 -0
- package/lib/test-helpers/virtual-terminal-flex-resize.test.js.map +1 -0
- package/lib/test-helpers/virtual-terminal.d.ts +176 -0
- package/lib/test-helpers/virtual-terminal.d.ts.map +1 -0
- package/lib/test-helpers/virtual-terminal.js +492 -0
- package/lib/test-helpers/virtual-terminal.js.map +1 -0
- package/lib/test-helpers/virtual-terminal.test.d.ts +2 -0
- package/lib/test-helpers/virtual-terminal.test.d.ts.map +1 -0
- package/lib/test-helpers/virtual-terminal.test.js +219 -0
- package/lib/test-helpers/virtual-terminal.test.js.map +1 -0
- package/lib/ts/components/spinner.test.d.ts +2 -0
- package/lib/ts/components/spinner.test.d.ts.map +1 -0
- package/lib/ts/components/spinner.test.js +168 -0
- package/lib/ts/components/spinner.test.js.map +1 -0
- package/lib/ts/utils/colors.test.d.ts +2 -0
- package/lib/ts/utils/colors.test.d.ts.map +1 -0
- package/lib/ts/utils/colors.test.js +87 -0
- package/lib/ts/utils/colors.test.js.map +1 -0
- package/lib/types.d.ts +8 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/colors-simple.d.ts +51 -0
- package/lib/utils/colors-simple.d.ts.map +1 -0
- package/lib/utils/colors-simple.js +59 -0
- package/lib/utils/colors-simple.js.map +1 -0
- package/lib/utils/colors.d.ts +1 -1
- package/lib/utils/colors.d.ts.map +1 -1
- package/lib/utils/colors.js.map +1 -1
- package/lib/utils/colors.test.d.ts +2 -0
- package/lib/utils/colors.test.d.ts.map +1 -0
- package/lib/utils/colors.test.js +87 -0
- package/lib/utils/colors.test.js.map +1 -0
- package/lib/utils/cursor-position.d.ts +22 -0
- package/lib/utils/cursor-position.d.ts.map +1 -0
- package/lib/utils/cursor-position.js +139 -0
- package/lib/utils/cursor-position.js.map +1 -0
- package/lib/utils/debug-log.d.ts +2 -0
- package/lib/utils/debug-log.d.ts.map +1 -0
- package/lib/utils/debug-log.js +36 -0
- package/lib/utils/debug-log.js.map +1 -0
- package/lib/utils/terminal.d.ts +27 -0
- package/lib/utils/terminal.d.ts.map +1 -0
- package/lib/utils/terminal.js +116 -0
- package/lib/utils/terminal.js.map +1 -0
- package/lib/utils/text.d.ts +21 -0
- package/lib/utils/text.d.ts.map +1 -0
- package/lib/utils/text.js +82 -0
- package/lib/utils/text.js.map +1 -0
- package/lib/utils/wait-for-spacebar.d.ts +10 -0
- package/lib/utils/wait-for-spacebar.d.ts.map +1 -0
- package/lib/utils/wait-for-spacebar.js +71 -0
- package/lib/utils/wait-for-spacebar.js.map +1 -0
- package/package.json +31 -28
- package/.cursor/plan.md +0 -952
- package/TESTING.md +0 -102
- package/build.zig +0 -100
- package/examples/basic-progress.ts +0 -21
- package/examples/multi-lane.ts +0 -29
- package/examples/spinner.ts +0 -20
- package/examples/test-basic.ts +0 -23
- package/src/ts/components/progress-bar.ts +0 -53
- package/src/ts/components/spinner.ts +0 -56
- package/src/ts/index.ts +0 -37
- package/src/ts/native.ts +0 -86
- package/src/ts/region.ts +0 -89
- package/src/ts/types/ffi-napi.d.ts +0 -11
- package/src/ts/types/ref-napi.d.ts +0 -5
- package/src/ts/types.ts +0 -53
- package/src/ts/utils/colors.ts +0 -72
- package/src/zig/ansi.zig +0 -21
- package/src/zig/buffer.zig +0 -37
- package/src/zig/diff.zig +0 -43
- package/src/zig/region.zig +0 -292
- package/src/zig/renderer.zig +0 -92
- package/src/zig/test_ansi.zig +0 -66
- package/src/zig/test_buffer.zig +0 -82
- package/src/zig/test_diff.zig +0 -220
- package/src/zig/test_integration.zig +0 -76
- package/src/zig/test_region.zig +0 -191
- package/src/zig/test_runner.zig +0 -27
- package/src/zig/test_throttle.zig +0 -59
- package/src/zig/throttle.zig +0 -38
- package/tsconfig.json +0 -21
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
// SIMPLIFIED Region rendering - back to first principles
|
|
2
|
+
//
|
|
3
|
+
// Core approach:
|
|
4
|
+
// 1. Reserve N lines at bottom of terminal
|
|
5
|
+
// 2. Save cursor position at end (our anchor)
|
|
6
|
+
// 3. To render: restore cursor, move up N lines, render each line, save cursor
|
|
7
|
+
// 4. Disable auto-wrap globally
|
|
8
|
+
// 5. Truncate content to width before writing
|
|
9
|
+
// 6. Use diff to only update changed lines
|
|
10
|
+
import * as ansi from './ansi';
|
|
11
|
+
import { RenderBuffer } from './buffer';
|
|
12
|
+
import { Throttle } from './throttle';
|
|
13
|
+
import { getTerminalWidth, getTerminalHeight, onResize } from '../utils/terminal';
|
|
14
|
+
export class TerminalRegion {
|
|
15
|
+
width;
|
|
16
|
+
height;
|
|
17
|
+
pendingFrame = [];
|
|
18
|
+
previousFrame = [];
|
|
19
|
+
throttle;
|
|
20
|
+
renderBuffer;
|
|
21
|
+
stdout;
|
|
22
|
+
disableRendering;
|
|
23
|
+
isInitialized = false;
|
|
24
|
+
resizeCleanup;
|
|
25
|
+
widthExplicitlySet;
|
|
26
|
+
// Track the absolute row where the region starts (1-based)
|
|
27
|
+
// This is calculated from terminal.rows on initialization and updated on resize
|
|
28
|
+
regionStartRow = null;
|
|
29
|
+
// Periodic check to re-disable auto-wrap (some terminals reset it)
|
|
30
|
+
autoWrapKeepAliveInterval;
|
|
31
|
+
// Optional callback to re-render the last component (for keep-alive during pause)
|
|
32
|
+
onKeepAlive;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.widthExplicitlySet = options.width !== undefined;
|
|
35
|
+
this.width = options.width ?? getTerminalWidth();
|
|
36
|
+
this.height = options.height ?? 1;
|
|
37
|
+
this.stdout = options.stdout ?? process.stdout;
|
|
38
|
+
this.disableRendering = options.disableRendering ?? false;
|
|
39
|
+
this.onKeepAlive = options.onKeepAlive;
|
|
40
|
+
// Initialize frames
|
|
41
|
+
this.pendingFrame = Array(this.height).fill('');
|
|
42
|
+
this.previousFrame = Array(this.height).fill('');
|
|
43
|
+
this.throttle = new Throttle(30); // Lower FPS for stability
|
|
44
|
+
this.renderBuffer = new RenderBuffer(this.stdout);
|
|
45
|
+
if (!this.disableRendering) {
|
|
46
|
+
this.initializeRegion();
|
|
47
|
+
if (!this.widthExplicitlySet) {
|
|
48
|
+
this.setupResizeHandler();
|
|
49
|
+
}
|
|
50
|
+
this.setupAutoWrapKeepAlive();
|
|
51
|
+
this.setupExitHandler();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
initializeRegion() {
|
|
55
|
+
if (this.isInitialized)
|
|
56
|
+
return;
|
|
57
|
+
// CRITICAL: Save cursor position FIRST (wherever we are)
|
|
58
|
+
// This allows us to start the region at the current cursor position
|
|
59
|
+
// instead of always pushing to the bottom
|
|
60
|
+
this.stdout.write(ansi.SAVE_CURSOR);
|
|
61
|
+
// Disable auto-wrap globally
|
|
62
|
+
this.stdout.write(ansi.DISABLE_AUTO_WRAP);
|
|
63
|
+
// Query cursor position to get the starting row
|
|
64
|
+
// We'll use a heuristic: save cursor, print newlines, then calculate
|
|
65
|
+
// The actual start row is where we saved the cursor
|
|
66
|
+
// After printing newlines, we're at (savedRow + height)
|
|
67
|
+
// So region starts at (savedRow + 1)
|
|
68
|
+
// For now, we'll use terminal.rows as a fallback, but try to use cursor position
|
|
69
|
+
// The issue is that querying cursor position is async, so we can't do it synchronously
|
|
70
|
+
// Instead, we'll save the cursor, print newlines, then calculate from terminal.rows
|
|
71
|
+
// But we'll adjust: if we're not at the bottom, we should use the saved position
|
|
72
|
+
// Reserve space by printing newlines (moves cursor down)
|
|
73
|
+
for (let i = 0; i < this.height; i++) {
|
|
74
|
+
this.stdout.write('\n');
|
|
75
|
+
}
|
|
76
|
+
// After printing newlines, calculate where the region starts
|
|
77
|
+
// We saved the cursor before printing, so the region starts at (savedRow + 1)
|
|
78
|
+
// But we can't easily get savedRow synchronously, so we'll use terminal.rows
|
|
79
|
+
// If we're at the bottom, this works. If not, we might be off.
|
|
80
|
+
// For now, assume we're at the bottom (matches current behavior)
|
|
81
|
+
const terminalRows = getTerminalHeight();
|
|
82
|
+
this.regionStartRow = Math.max(1, terminalRows - this.height + 1);
|
|
83
|
+
this.isInitialized = true;
|
|
84
|
+
}
|
|
85
|
+
setupAutoWrapKeepAlive() {
|
|
86
|
+
// CRITICAL: Periodically re-render to keep auto-wrap disabled and re-establish content
|
|
87
|
+
// Some terminals reset auto-wrap state, especially after resize or when idle
|
|
88
|
+
// When paused (waiting for spacebar), we're not in an active render loop anymore,
|
|
89
|
+
// so we need to keep rendering periodically to prevent auto-reflow
|
|
90
|
+
// This is the same as the progress bar animation loop - continuous rendering
|
|
91
|
+
// Check every 50ms - more frequent to catch resets faster, matching animation frequency
|
|
92
|
+
this.autoWrapKeepAliveInterval = setInterval(() => {
|
|
93
|
+
if (!this.disableRendering && this.isInitialized) {
|
|
94
|
+
// CRITICAL: Re-disable auto-wrap FIRST (some terminals reset it)
|
|
95
|
+
// Write directly to stdout to ensure it takes effect immediately
|
|
96
|
+
this.stdout.write(ansi.DISABLE_AUTO_WRAP);
|
|
97
|
+
// CRITICAL: If we have a callback to re-render the last component, use it
|
|
98
|
+
// This re-renders flex/col components with current width (same as during animation)
|
|
99
|
+
// If no callback, just re-render existing pendingFrame
|
|
100
|
+
if (this.onKeepAlive) {
|
|
101
|
+
this.onKeepAlive();
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
// Fallback: just re-render existing content
|
|
105
|
+
this.renderNow();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, 50);
|
|
109
|
+
}
|
|
110
|
+
setupResizeHandler() {
|
|
111
|
+
this.resizeCleanup = onResize((newWidth, newHeight) => {
|
|
112
|
+
// Re-disable auto-wrap (some terminals reset on resize)
|
|
113
|
+
if (!this.disableRendering) {
|
|
114
|
+
this.stdout.write(ansi.DISABLE_AUTO_WRAP);
|
|
115
|
+
}
|
|
116
|
+
if (!this.widthExplicitlySet) {
|
|
117
|
+
this.width = newWidth;
|
|
118
|
+
}
|
|
119
|
+
// CRITICAL: On resize, DO NOT recalculate regionStartRow
|
|
120
|
+
// The region's absolute position doesn't change when the terminal resizes
|
|
121
|
+
// If we recalculate, we might move the region to the wrong place (especially
|
|
122
|
+
// if waitForSpacebar or other code has caused scrolling)
|
|
123
|
+
// Only update width, keep regionStartRow as-is
|
|
124
|
+
// CRITICAL: Force immediate render (bypass throttle) to update with new size
|
|
125
|
+
// This ensures we re-render even when paused/idle, preventing auto-reflow
|
|
126
|
+
// Render IMMEDIATELY (no setTimeout) to fix any reflow as fast as possible
|
|
127
|
+
// The terminal may have already reflowed content, but we fix it immediately
|
|
128
|
+
// CRITICAL: Always read the latest width right before rendering
|
|
129
|
+
// This ensures we never render with stale width, preventing chopping
|
|
130
|
+
if (!this.widthExplicitlySet) {
|
|
131
|
+
this.width = getTerminalWidth();
|
|
132
|
+
}
|
|
133
|
+
// Double-check one more time right before render
|
|
134
|
+
const latestWidth = getTerminalWidth();
|
|
135
|
+
if (!this.widthExplicitlySet && latestWidth !== this.width) {
|
|
136
|
+
this.width = latestWidth;
|
|
137
|
+
}
|
|
138
|
+
// CRITICAL: If we have a callback to re-render the last content, use it
|
|
139
|
+
// This re-renders ALL components (flex/col) with current width (same as during animation)
|
|
140
|
+
// The region orchestrates this - components don't manage their own re-rendering
|
|
141
|
+
// If no callback, just re-render existing pendingFrame
|
|
142
|
+
if (this.onKeepAlive) {
|
|
143
|
+
this.onKeepAlive();
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// Fallback: just re-render existing content
|
|
147
|
+
this.renderNow();
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
setupExitHandler() {
|
|
152
|
+
const cleanup = () => {
|
|
153
|
+
if (this.isInitialized) {
|
|
154
|
+
this.destroy();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
process.once('exit', cleanup);
|
|
158
|
+
process.once('SIGINT', cleanup);
|
|
159
|
+
process.once('SIGTERM', cleanup);
|
|
160
|
+
process.once('uncaughtException', (error, origin) => {
|
|
161
|
+
cleanup();
|
|
162
|
+
const originalListeners = process.listeners('uncaughtException');
|
|
163
|
+
originalListeners.forEach((listener) => {
|
|
164
|
+
listener(error, origin);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
getWidth() {
|
|
169
|
+
if (!this.widthExplicitlySet) {
|
|
170
|
+
this.width = getTerminalWidth();
|
|
171
|
+
}
|
|
172
|
+
return this.width;
|
|
173
|
+
}
|
|
174
|
+
getHeight() {
|
|
175
|
+
return this.height;
|
|
176
|
+
}
|
|
177
|
+
setLine(lineNumber, content) {
|
|
178
|
+
if (lineNumber < 1) {
|
|
179
|
+
throw new Error('Line numbers start at 1');
|
|
180
|
+
}
|
|
181
|
+
const lineIndex = lineNumber - 1;
|
|
182
|
+
// CRITICAL: Only expand if lineIndex is within reasonable bounds
|
|
183
|
+
// If someone calls setLine with a very high number (e.g., from waitForSpacebar),
|
|
184
|
+
// we should NOT expand the region - just ignore it or truncate
|
|
185
|
+
// The region height should be controlled by the component layer, not by setLine calls
|
|
186
|
+
if (lineIndex >= this.height) {
|
|
187
|
+
// Only expand if it's not too far beyond current height (safety check)
|
|
188
|
+
// This prevents accidental expansion from stray setLine calls
|
|
189
|
+
// Limit expansion to at most 10 lines beyond current height
|
|
190
|
+
const maxAllowedHeight = this.height + 10;
|
|
191
|
+
if (lineIndex < maxAllowedHeight) {
|
|
192
|
+
this.expandTo(lineIndex + 1);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Line number is way too high - expand to max allowed, then ignore the rest
|
|
196
|
+
this.expandTo(maxAllowedHeight);
|
|
197
|
+
// Don't update the line if it's beyond max allowed
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Ensure pending frame has enough lines (but don't let it grow unbounded)
|
|
202
|
+
while (this.pendingFrame.length <= lineIndex && this.pendingFrame.length < this.height + 10) {
|
|
203
|
+
this.pendingFrame.push('');
|
|
204
|
+
}
|
|
205
|
+
// Only update if within bounds
|
|
206
|
+
if (lineIndex < this.pendingFrame.length) {
|
|
207
|
+
this.pendingFrame[lineIndex] = content;
|
|
208
|
+
}
|
|
209
|
+
// Schedule render
|
|
210
|
+
this.scheduleRender();
|
|
211
|
+
}
|
|
212
|
+
expandTo(newHeight) {
|
|
213
|
+
const oldHeight = this.height;
|
|
214
|
+
this.height = newHeight;
|
|
215
|
+
// Expand frames
|
|
216
|
+
while (this.pendingFrame.length < newHeight) {
|
|
217
|
+
this.pendingFrame.push('');
|
|
218
|
+
}
|
|
219
|
+
while (this.previousFrame.length < newHeight) {
|
|
220
|
+
this.previousFrame.push('');
|
|
221
|
+
}
|
|
222
|
+
// Reserve additional lines if initialized
|
|
223
|
+
if (this.isInitialized && newHeight > oldHeight && !this.disableRendering) {
|
|
224
|
+
const additionalLines = newHeight - oldHeight;
|
|
225
|
+
for (let i = 0; i < additionalLines; i++) {
|
|
226
|
+
this.stdout.write('\n');
|
|
227
|
+
}
|
|
228
|
+
// Re-save cursor position after expansion
|
|
229
|
+
this.stdout.write(ansi.SAVE_CURSOR);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
set(content) {
|
|
233
|
+
const lines = content.split('\n');
|
|
234
|
+
if (lines.length > this.height) {
|
|
235
|
+
this.expandTo(lines.length);
|
|
236
|
+
}
|
|
237
|
+
this.pendingFrame = [...lines];
|
|
238
|
+
while (this.pendingFrame.length < this.height) {
|
|
239
|
+
this.pendingFrame.push('');
|
|
240
|
+
}
|
|
241
|
+
this.scheduleRender();
|
|
242
|
+
}
|
|
243
|
+
getLine(lineNumber) {
|
|
244
|
+
if (lineNumber < 1) {
|
|
245
|
+
throw new Error('Line numbers start at 1');
|
|
246
|
+
}
|
|
247
|
+
const lineIndex = lineNumber - 1;
|
|
248
|
+
return this.pendingFrame[lineIndex] || '';
|
|
249
|
+
}
|
|
250
|
+
clear() {
|
|
251
|
+
for (let i = 0; i < this.pendingFrame.length; i++) {
|
|
252
|
+
this.pendingFrame[i] = '';
|
|
253
|
+
}
|
|
254
|
+
this.scheduleRender();
|
|
255
|
+
}
|
|
256
|
+
clearLine(lineNumber) {
|
|
257
|
+
this.setLine(lineNumber, '');
|
|
258
|
+
}
|
|
259
|
+
scheduleRender() {
|
|
260
|
+
if (this.disableRendering) {
|
|
261
|
+
this.previousFrame = [...this.pendingFrame];
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (this.throttle.shouldRender()) {
|
|
265
|
+
this.renderNow();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* SIMPLIFIED RENDERING - back to basics
|
|
270
|
+
*
|
|
271
|
+
* Uses absolute positioning based on terminal rows:
|
|
272
|
+
* - Region is at bottom: starts at row (rows - height + 1), ends at row (rows)
|
|
273
|
+
* - On resize, we recalculate using new rows value
|
|
274
|
+
*
|
|
275
|
+
* 1. Calculate absolute row positions from terminal.rows
|
|
276
|
+
* 2. Move to start of region using absolute positioning
|
|
277
|
+
* 3. For each line: clear, write (truncated), move to start, move down
|
|
278
|
+
* 4. Save cursor position at end
|
|
279
|
+
*/
|
|
280
|
+
renderNow() {
|
|
281
|
+
if (this.disableRendering) {
|
|
282
|
+
this.previousFrame = [...this.pendingFrame];
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
if (!this.isInitialized) {
|
|
286
|
+
this.initializeRegion();
|
|
287
|
+
}
|
|
288
|
+
// CRITICAL: Don't prevent concurrent renders - the throttle handles that
|
|
289
|
+
// Removing isRendering check to prevent duplicates
|
|
290
|
+
// The throttle will naturally prevent too-frequent renders
|
|
291
|
+
// CRITICAL: Always disable auto-wrap before rendering
|
|
292
|
+
// Write directly to stdout to ensure it takes effect immediately
|
|
293
|
+
// This is especially important after resize when terminal might have reset state
|
|
294
|
+
// We ALWAYS keep auto-wrap disabled - never re-enable it (except on destroy)
|
|
295
|
+
// This prevents auto-reflow even when idle/paused
|
|
296
|
+
this.stdout.write(ansi.DISABLE_AUTO_WRAP);
|
|
297
|
+
this.renderBuffer.write(ansi.HIDE_CURSOR);
|
|
298
|
+
// CRITICAL: Use absolute positioning based on regionStartRow
|
|
299
|
+
// This is more reliable than SAVE/RESTORE, especially after resize
|
|
300
|
+
// If regionStartRow is not set, fall back to relative positioning
|
|
301
|
+
if (this.regionStartRow !== null) {
|
|
302
|
+
// Move to start of first line of region
|
|
303
|
+
this.renderBuffer.write(ansi.moveCursorTo(1, this.regionStartRow));
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
// Fallback: use SAVE/RESTORE (shouldn't happen if initialized correctly)
|
|
307
|
+
this.renderBuffer.write(ansi.RESTORE_CURSOR);
|
|
308
|
+
if (this.height > 0) {
|
|
309
|
+
this.renderBuffer.write(ansi.moveCursorUp(this.height));
|
|
310
|
+
}
|
|
311
|
+
this.renderBuffer.write(ansi.MOVE_TO_START_OF_LINE);
|
|
312
|
+
}
|
|
313
|
+
// CRITICAL: Only render exactly height lines, no more
|
|
314
|
+
// pendingFrame might have more lines if setLine was called with high line numbers
|
|
315
|
+
// But we should ONLY render up to this.height lines
|
|
316
|
+
// Truncate pendingFrame if it's too long (safety check)
|
|
317
|
+
if (this.pendingFrame.length > this.height) {
|
|
318
|
+
this.pendingFrame = this.pendingFrame.slice(0, this.height);
|
|
319
|
+
}
|
|
320
|
+
const linesToRender = this.height;
|
|
321
|
+
// Render each line
|
|
322
|
+
for (let i = 0; i < linesToRender; i++) {
|
|
323
|
+
const content = this.pendingFrame[i] || '';
|
|
324
|
+
// Clear the line
|
|
325
|
+
this.renderBuffer.write(ansi.CLEAR_LINE);
|
|
326
|
+
this.renderBuffer.write(ansi.MOVE_TO_START_OF_LINE);
|
|
327
|
+
// CRITICAL: Reset colors to prevent color bleeding from previous line
|
|
328
|
+
// This ensures each line starts with a clean color state
|
|
329
|
+
this.renderBuffer.write(ansi.RESET);
|
|
330
|
+
// CRITICAL: Always use the latest width for truncation
|
|
331
|
+
// Re-read width right before truncating to prevent chopping during resize
|
|
332
|
+
// This is especially important when paused (waiting for spacebar)
|
|
333
|
+
const currentWidth = this.widthExplicitlySet ? this.width : getTerminalWidth();
|
|
334
|
+
// Truncate content to width (strip ANSI to measure, then truncate preserving ANSI)
|
|
335
|
+
const plainContent = content.replace(/\x1b\[[0-9;]*m/g, '');
|
|
336
|
+
let contentToWrite = content;
|
|
337
|
+
if (plainContent.length > currentWidth) {
|
|
338
|
+
let visualPos = 0;
|
|
339
|
+
let charPos = 0;
|
|
340
|
+
while (charPos < content.length && visualPos < currentWidth) {
|
|
341
|
+
if (content[charPos] === '\x1b') {
|
|
342
|
+
let ansiEnd = charPos + 1;
|
|
343
|
+
while (ansiEnd < content.length) {
|
|
344
|
+
if (content[ansiEnd] === 'm') {
|
|
345
|
+
ansiEnd++;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if ((content[ansiEnd] >= '0' && content[ansiEnd] <= '9') ||
|
|
349
|
+
content[ansiEnd] === ';' ||
|
|
350
|
+
content[ansiEnd] === '[') {
|
|
351
|
+
ansiEnd++;
|
|
352
|
+
}
|
|
353
|
+
else {
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
charPos = ansiEnd;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
charPos++;
|
|
361
|
+
visualPos++;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
contentToWrite = content.substring(0, charPos);
|
|
365
|
+
}
|
|
366
|
+
// Write content
|
|
367
|
+
this.renderBuffer.write(contentToWrite);
|
|
368
|
+
// Move to start of line
|
|
369
|
+
this.renderBuffer.write(ansi.MOVE_TO_START_OF_LINE);
|
|
370
|
+
// Move down to next line (unless last line)
|
|
371
|
+
if (i < linesToRender - 1) {
|
|
372
|
+
this.renderBuffer.write(ansi.moveCursorDown(1));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
// We're now at the start of the last rendered line
|
|
376
|
+
// Move down 1 to get to the line after the region
|
|
377
|
+
if (linesToRender > 0) {
|
|
378
|
+
this.renderBuffer.write(ansi.moveCursorDown(1));
|
|
379
|
+
}
|
|
380
|
+
// CRITICAL: Update regionStartRow if we're using absolute positioning
|
|
381
|
+
// After rendering, we're at row (regionStartRow + height)
|
|
382
|
+
// On next render, we'll use this to position correctly
|
|
383
|
+
// (We don't need to save cursor position since we're using absolute positioning)
|
|
384
|
+
// Show cursor
|
|
385
|
+
this.renderBuffer.write(ansi.SHOW_CURSOR);
|
|
386
|
+
// Flush
|
|
387
|
+
this.renderBuffer.flush();
|
|
388
|
+
// Update previous frame
|
|
389
|
+
this.previousFrame = [...this.pendingFrame];
|
|
390
|
+
}
|
|
391
|
+
flush() {
|
|
392
|
+
this.renderNow();
|
|
393
|
+
}
|
|
394
|
+
destroy(clearFirst = false) {
|
|
395
|
+
if (!this.isInitialized)
|
|
396
|
+
return;
|
|
397
|
+
// Stop the auto-wrap keep-alive interval
|
|
398
|
+
if (this.autoWrapKeepAliveInterval) {
|
|
399
|
+
clearInterval(this.autoWrapKeepAliveInterval);
|
|
400
|
+
this.autoWrapKeepAliveInterval = undefined;
|
|
401
|
+
}
|
|
402
|
+
if (clearFirst) {
|
|
403
|
+
this.clear();
|
|
404
|
+
this.renderNow();
|
|
405
|
+
}
|
|
406
|
+
// Re-enable auto-wrap
|
|
407
|
+
if (!this.disableRendering) {
|
|
408
|
+
this.stdout.write(ansi.ENABLE_AUTO_WRAP);
|
|
409
|
+
}
|
|
410
|
+
// Check if all lines are blank
|
|
411
|
+
const allLinesBlank = this.previousFrame.every(line => line.trim() === '');
|
|
412
|
+
if (allLinesBlank && this.height > 0) {
|
|
413
|
+
// Restore cursor, move to start of region, delete lines
|
|
414
|
+
this.renderBuffer.write(ansi.RESTORE_CURSOR);
|
|
415
|
+
this.renderBuffer.write(ansi.moveCursorUp(this.height));
|
|
416
|
+
this.renderBuffer.write(ansi.MOVE_TO_START_OF_LINE);
|
|
417
|
+
this.renderBuffer.write(ansi.deleteLines(this.height));
|
|
418
|
+
this.renderBuffer.flush();
|
|
419
|
+
}
|
|
420
|
+
if (this.resizeCleanup) {
|
|
421
|
+
this.resizeCleanup();
|
|
422
|
+
}
|
|
423
|
+
this.isInitialized = false;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
//# sourceMappingURL=region.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"region.js","sourceRoot":"","sources":["../../src/native/region.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,GAAG;AACH,iBAAiB;AACjB,2CAA2C;AAC3C,8CAA8C;AAC9C,+EAA+E;AAC/E,gCAAgC;AAChC,8CAA8C;AAC9C,2CAA2C;AAG3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAWlF,MAAM,OAAO,cAAc;IACjB,KAAK,CAAS;IACd,MAAM,C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