@aiwayds/dsh-tui-pi 0.7.2 → 0.8.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/README.md +12 -10
- package/lib/canvas-terminal.d.ts +37 -0
- package/lib/canvas-terminal.js +91 -0
- package/lib/canvas-terminal.js.map +1 -0
- package/lib/theme/index.js +6 -12
- package/lib/theme/index.js.map +1 -1
- package/lib/theme/palette.d.ts +2 -2
- package/lib/theme/palette.js +2 -2
- package/lib/tui.js +18 -18
- package/lib/tui.js.map +1 -1
- package/package.json +1 -2
- package/scripts/dev-install.mjs +0 -2
- package/patches/@earendil-works__pi-tui.patch +0 -276
package/README.md
CHANGED
|
@@ -200,6 +200,10 @@ GitHub light / GitHub dark palettes, hot-switchable at runtime:
|
|
|
200
200
|
- `DSH_TUI_TRANSPARENT=1` — see-through canvas (terminal background shows through).
|
|
201
201
|
- `auto` mode detects the terminal and follows live light/dark switches.
|
|
202
202
|
|
|
203
|
+
The full-screen canvas background ships inside the package — a write-stream
|
|
204
|
+
decorator (`src/canvas-terminal.ts`) paints every erase sequence with the
|
|
205
|
+
theme color via BCE, no patched dependencies.
|
|
206
|
+
|
|
203
207
|
---
|
|
204
208
|
|
|
205
209
|
## Install (local)
|
|
@@ -247,12 +251,10 @@ dsh --profile tui
|
|
|
247
251
|
|
|
248
252
|
**What does NOT happen automatically:**
|
|
249
253
|
|
|
250
|
-
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
without the patch; the unpatched select-list just renders unselected rows
|
|
255
|
-
as plain `prefix + value` instead of a full-row backdrop.
|
|
254
|
+
- Nothing patch-related anymore: since 0.8.0 the repo and the npm package
|
|
255
|
+
run the same pristine `@earendil-works/pi-tui` — the canvas background is
|
|
256
|
+
painted by our own write-stream decorator (BCE), which ships in the
|
|
257
|
+
package and needs no `pnpm-workspace.yaml` entries in consumer profiles.
|
|
256
258
|
|
|
257
259
|
### Troubleshooting
|
|
258
260
|
|
|
@@ -278,7 +280,7 @@ dsh --profile tui # or: dsh-tui-pi (bin shim)
|
|
|
278
280
|
```sh
|
|
279
281
|
pnpm check # tsc --noEmit
|
|
280
282
|
pnpm build # emit lib/
|
|
281
|
-
pnpm test # unit tests, node --test against lib/ (
|
|
283
|
+
pnpm test # unit tests, node --test against lib/ (386 tests, pretest builds)
|
|
282
284
|
```
|
|
283
285
|
|
|
284
286
|
Local type-checking symlinks `node_modules/@deepseek-ai/*` to the installed
|
|
@@ -286,9 +288,9 @@ dsh closure (`/opt/homebrew/lib/node_modules/@deepseek-ai/dsh/node_modules`);
|
|
|
286
288
|
those symlinks stay out of any tarball. `scripts/link-dsh-closure.mjs` (the
|
|
287
289
|
package's `postinstall`) re-creates every link after each `pnpm install`.
|
|
288
290
|
|
|
289
|
-
**pi-tui
|
|
290
|
-
|
|
291
|
-
`
|
|
291
|
+
**pi-tui**: pristine `@earendil-works/pi-tui` 0.84.2 from npm — no patches,
|
|
292
|
+
no fork. The full-screen canvas background is our own write-stream decorator
|
|
293
|
+
(`src/canvas-terminal.ts`, BCE).
|
|
292
294
|
|
|
293
295
|
---
|
|
294
296
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal write-stream decorator painting the canvas via BCE.
|
|
3
|
+
*
|
|
4
|
+
* pi-tui renders rows as `\x1b[{row};1H\x1b[2K{line}` and full redraws as
|
|
5
|
+
* `\x1b[2J` — no background of their own. Terminals with BCE (back color
|
|
6
|
+
* erase) fill erased regions with the current SGR background, so prefixing
|
|
7
|
+
* the canvas background before every erase sequence paints the whole screen
|
|
8
|
+
* without touching pi-tui. Rows the diff renderer skips keep the background
|
|
9
|
+
* of their last paint, which is correct until the canvas color changes —
|
|
10
|
+
* the caller must then force a full redraw (requestRender(true)).
|
|
11
|
+
*/
|
|
12
|
+
import type { Terminal } from '@earendil-works/pi-tui';
|
|
13
|
+
export declare class CanvasTerminal implements Terminal {
|
|
14
|
+
/** '' = transparent passthrough (DSH_TUI_TRANSPARENT). */
|
|
15
|
+
private background;
|
|
16
|
+
/** False once the alt-screen exit sequence is seen — the main-screen document dump that follows stays unpainted. */
|
|
17
|
+
private active;
|
|
18
|
+
private readonly inner;
|
|
19
|
+
constructor(inner: Terminal);
|
|
20
|
+
/** Set the canvas background SGR; undefined reverts to transparent. */
|
|
21
|
+
setCanvasBackground(bg: string | undefined): void;
|
|
22
|
+
write(data: string): void;
|
|
23
|
+
start(onInput: (data: string) => void, onResize: () => void): void;
|
|
24
|
+
stop(): void;
|
|
25
|
+
drainInput(maxMs?: number, idleMs?: number): Promise<void>;
|
|
26
|
+
get columns(): number;
|
|
27
|
+
get rows(): number;
|
|
28
|
+
get kittyProtocolActive(): boolean;
|
|
29
|
+
moveBy(lines: number): void;
|
|
30
|
+
hideCursor(): void;
|
|
31
|
+
showCursor(): void;
|
|
32
|
+
clearLine(): void;
|
|
33
|
+
clearFromCursor(): void;
|
|
34
|
+
clearScreen(): void;
|
|
35
|
+
setTitle(title: string): void;
|
|
36
|
+
setProgress(active: boolean): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal write-stream decorator painting the canvas via BCE.
|
|
3
|
+
*
|
|
4
|
+
* pi-tui renders rows as `\x1b[{row};1H\x1b[2K{line}` and full redraws as
|
|
5
|
+
* `\x1b[2J` — no background of their own. Terminals with BCE (back color
|
|
6
|
+
* erase) fill erased regions with the current SGR background, so prefixing
|
|
7
|
+
* the canvas background before every erase sequence paints the whole screen
|
|
8
|
+
* without touching pi-tui. Rows the diff renderer skips keep the background
|
|
9
|
+
* of their last paint, which is correct until the canvas color changes —
|
|
10
|
+
* the caller must then force a full redraw (requestRender(true)).
|
|
11
|
+
*/
|
|
12
|
+
const ENTER_ALT_SCREEN = '\x1b[?1049h';
|
|
13
|
+
const EXIT_ALT_SCREEN = '\x1b[?1049l';
|
|
14
|
+
export class CanvasTerminal {
|
|
15
|
+
/** '' = transparent passthrough (DSH_TUI_TRANSPARENT). */
|
|
16
|
+
background = '';
|
|
17
|
+
/** False once the alt-screen exit sequence is seen — the main-screen document dump that follows stays unpainted. */
|
|
18
|
+
active = true;
|
|
19
|
+
inner;
|
|
20
|
+
constructor(inner) {
|
|
21
|
+
this.inner = inner;
|
|
22
|
+
}
|
|
23
|
+
/** Set the canvas background SGR; undefined reverts to transparent. */
|
|
24
|
+
setCanvasBackground(bg) {
|
|
25
|
+
this.background = bg ?? '';
|
|
26
|
+
}
|
|
27
|
+
write(data) {
|
|
28
|
+
if (data.includes(EXIT_ALT_SCREEN)) {
|
|
29
|
+
// The exit buffer starts with EXIT_ALT_SCREEN; write it (and anything
|
|
30
|
+
// after, until the next enter) unchanged so quitting leaves no themed
|
|
31
|
+
// background behind on the shell.
|
|
32
|
+
this.active = false;
|
|
33
|
+
this.inner.write(data);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (data.includes(ENTER_ALT_SCREEN))
|
|
37
|
+
this.active = true;
|
|
38
|
+
if (this.background === '' || !this.active) {
|
|
39
|
+
this.inner.write(data);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Injection happens only at erase-sequence boundaries; kitty image
|
|
43
|
+
// payloads are APC base64/hex and never contain ESC bytes.
|
|
44
|
+
this.inner.write(data
|
|
45
|
+
.replaceAll('\x1b[2K', `${this.background}\x1b[2K`)
|
|
46
|
+
.replaceAll('\x1b[2J', `${this.background}\x1b[2J`));
|
|
47
|
+
}
|
|
48
|
+
start(onInput, onResize) {
|
|
49
|
+
this.inner.start(onInput, onResize);
|
|
50
|
+
}
|
|
51
|
+
stop() {
|
|
52
|
+
this.inner.stop();
|
|
53
|
+
}
|
|
54
|
+
drainInput(maxMs, idleMs) {
|
|
55
|
+
return this.inner.drainInput(maxMs, idleMs);
|
|
56
|
+
}
|
|
57
|
+
get columns() {
|
|
58
|
+
return this.inner.columns;
|
|
59
|
+
}
|
|
60
|
+
get rows() {
|
|
61
|
+
return this.inner.rows;
|
|
62
|
+
}
|
|
63
|
+
get kittyProtocolActive() {
|
|
64
|
+
return this.inner.kittyProtocolActive;
|
|
65
|
+
}
|
|
66
|
+
moveBy(lines) {
|
|
67
|
+
this.inner.moveBy(lines);
|
|
68
|
+
}
|
|
69
|
+
hideCursor() {
|
|
70
|
+
this.inner.hideCursor();
|
|
71
|
+
}
|
|
72
|
+
showCursor() {
|
|
73
|
+
this.inner.showCursor();
|
|
74
|
+
}
|
|
75
|
+
clearLine() {
|
|
76
|
+
this.inner.clearLine();
|
|
77
|
+
}
|
|
78
|
+
clearFromCursor() {
|
|
79
|
+
this.inner.clearFromCursor();
|
|
80
|
+
}
|
|
81
|
+
clearScreen() {
|
|
82
|
+
this.inner.clearScreen();
|
|
83
|
+
}
|
|
84
|
+
setTitle(title) {
|
|
85
|
+
this.inner.setTitle(title);
|
|
86
|
+
}
|
|
87
|
+
setProgress(active) {
|
|
88
|
+
this.inner.setProgress(active);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=canvas-terminal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas-terminal.js","sourceRoot":"","sources":["../src/canvas-terminal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,gBAAgB,GAAG,aAAa,CAAA;AACtC,MAAM,eAAe,GAAG,aAAa,CAAA;AAErC,MAAM,OAAO,cAAc;IACzB,0DAA0D;IAClD,UAAU,GAAG,EAAE,CAAA;IACvB,oHAAoH;IAC5G,MAAM,GAAG,IAAI,CAAA;IACJ,KAAK,CAAU;IAEhC,YAAY,KAAe;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,uEAAuE;IACvE,mBAAmB,CAAC,EAAsB;QACxC,IAAI,CAAC,UAAU,GAAG,EAAE,IAAI,EAAE,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,IAAY;QAChB,IAAI,IAAI,CAAC,QA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,CAAA;IACvC,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;IAED,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAA;IACzB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAA;IACzB,CAAC;IAED,SAAS;QACP,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAA;IACxB,CAAC;IAED,eAAe;QACb,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAA;IAC9B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAA;IAC1B,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,WAAW,CAAC,MAAe;QACzB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;CACF"}
|
package/lib/theme/index.js
CHANGED
|
@@ -47,27 +47,21 @@ export function buildTheme(palette) {
|
|
|
47
47
|
const fg = (hex) => (text) => ansiFg(hex) + text + RESET;
|
|
48
48
|
const bg = (hex) => (text) => ansiBg(hex) + text + RESET;
|
|
49
49
|
const bold = (text) => BOLD + text + RESET;
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
// (
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
// theme, so its rows get the same full-row treatment.
|
|
50
|
+
// Picker rows. Upstream SelectList themes only the selected row (via
|
|
51
|
+
// selectedText, which receives the "→ value …" row whole), plus the
|
|
52
|
+
// description / scroll info / no-match lines; unselected value rows render
|
|
53
|
+
// plain (upstream has no hook for them). selectedPrefix is required by the
|
|
54
|
+
// SelectListTheme interface even though upstream 0.84.2 never calls it.
|
|
55
|
+
// Editor-inline slash autocomplete shares this selectList theme.
|
|
57
56
|
const selectList = {
|
|
58
57
|
selectedPrefix: text => bg(palette.canvasSubtle)(fg(palette.accent)(bold(`▸ ${text}`))),
|
|
59
58
|
selectedText: text => bg(palette.canvasSubtle)(fg(palette.fgDefault)(bold(text))),
|
|
60
59
|
description: text => bg(palette.canvasSubtle)(fg(palette.fgSubtle)(text)),
|
|
61
60
|
scrollInfo: text => bg(palette.canvasSubtle)(fg(palette.fgSubtle)(text)),
|
|
62
61
|
noMatch: text => bg(palette.canvasSubtle)(fg(palette.danger)(text)),
|
|
63
|
-
unselectedText: text => bg(palette.canvasSubtle)(fg(palette.fgDefault)(text)),
|
|
64
62
|
};
|
|
65
63
|
const editor = {
|
|
66
64
|
borderColor: fg(palette.borderDefault),
|
|
67
|
-
// The editor's input rows are otherwise unstyled (terminal default
|
|
68
|
-
// foreground), which is invisible on the app-painted dark canvas — theme
|
|
69
|
-
// the typed text with the palette's body color (light text on dark).
|
|
70
|
-
textColor: fg(palette.fgDefault),
|
|
71
65
|
selectList,
|
|
72
66
|
};
|
|
73
67
|
const markdown = {
|
package/lib/theme/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAgB,MAAM,cAAc,CAAA;AAEvF,iDAAiD;AACjD,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACvC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACvC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAA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OAAO,SAAS,CAAA;IAC3C,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAA;AACxD,CAAC"}
|
package/lib/theme/palette.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* `canvas` (the terminal can't carry alpha) — same values as `blend()`
|
|
14
14
|
* below.
|
|
15
15
|
*
|
|
16
|
-
* The TUI paints every rendered row with `canvas` (
|
|
17
|
-
*
|
|
16
|
+
* The TUI paints every rendered row with `canvas` (BCE write-stream
|
|
17
|
+
* decorator, see src/canvas-terminal.ts) — the app owns its background, so
|
|
18
18
|
* a theme switch recolors the whole screen and the terminal/multiplexer
|
|
19
19
|
* background never shows through. `canvasSubtle` stays the visible raised
|
|
20
20
|
* surface on top of it. DSH_TUI_TRANSPARENT=1 reverts to the old
|
package/lib/theme/palette.js
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* `canvas` (the terminal can't carry alpha) — same values as `blend()`
|
|
14
14
|
* below.
|
|
15
15
|
*
|
|
16
|
-
* The TUI paints every rendered row with `canvas` (
|
|
17
|
-
*
|
|
16
|
+
* The TUI paints every rendered row with `canvas` (BCE write-stream
|
|
17
|
+
* decorator, see src/canvas-terminal.ts) — the app owns its background, so
|
|
18
18
|
* a theme switch recolors the whole screen and the terminal/multiplexer
|
|
19
19
|
* background never shows through. `canvasSubtle` stays the visible raised
|
|
20
20
|
* surface on top of it. DSH_TUI_TRANSPARENT=1 reverts to the old
|
package/lib/tui.js
CHANGED
|
@@ -19,31 +19,28 @@
|
|
|
19
19
|
* counts) is maintained incrementally by event listeners and read O(1) here.
|
|
20
20
|
*/
|
|
21
21
|
import { Container, matchesKey, ProcessTerminal, ScrollView, Spacer, Text, TuiAltScreen, VStack, } from '@earendil-works/pi-tui';
|
|
22
|
+
import { CanvasTerminal } from "./canvas-terminal.js";
|
|
22
23
|
import { CwdBorderEditor } from "./editor.js";
|
|
23
24
|
import { mergeKeyBindings, resolveKeyAction } from "./keymap.js";
|
|
24
25
|
import { ansiBg, ansiFg, RESET, resolveTheme } from "./theme/index.js";
|
|
25
26
|
export function startTui(options = {}) {
|
|
26
|
-
const terminal = new ProcessTerminal();
|
|
27
|
+
const terminal = new CanvasTerminal(new ProcessTerminal());
|
|
27
28
|
const tui = new TuiAltScreen(terminal, true);
|
|
28
29
|
// Mutable theme ref: `applyTheme` swaps it and every later read (handle
|
|
29
30
|
// getter, baked closures below) observes the new bundle on the next call.
|
|
30
31
|
let themeRef = resolveTheme(process.env, options.themePreference ?? 'auto');
|
|
31
|
-
// App-owned canvas:
|
|
32
|
-
// canvas background
|
|
33
|
-
// switch recolors the WHOLE screen, not
|
|
34
|
-
// own bg. Without it the terminal
|
|
35
|
-
// unpainted rows and "freezes" on
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
// terminal theme to stay
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
// setCanvasBackground, and calling it would crash TUI startup into a
|
|
42
|
-
// silent blank screen. Degrade to the transparent canvas instead.
|
|
43
|
-
const paintCanvas = process.env.DSH_TUI_TRANSPARENT !== '1'
|
|
44
|
-
&& typeof tui.setCanvasBackground === 'function';
|
|
32
|
+
// App-owned canvas: the write-stream decorator injects the palette's
|
|
33
|
+
// canvas background before every erase sequence (BCE — see
|
|
34
|
+
// canvas-terminal.ts), so a theme switch recolors the WHOLE screen, not
|
|
35
|
+
// only the surfaces that paint their own bg. Without it the terminal
|
|
36
|
+
// default background shows through the unpainted rows and "freezes" on
|
|
37
|
+
// switch — most visible inside cmux/gostty, where the pane background
|
|
38
|
+
// belongs to the multiplexer. DSH_TUI_TRANSPARENT=1 opts back into the
|
|
39
|
+
// old see-through canvas for users who want their terminal theme to stay
|
|
40
|
+
// visible.
|
|
41
|
+
const paintCanvas = process.env.DSH_TUI_TRANSPARENT !== '1';
|
|
45
42
|
if (paintCanvas)
|
|
46
|
-
|
|
43
|
+
terminal.setCanvasBackground(ansiBg(themeRef.palette.canvas));
|
|
47
44
|
// ------------------------------------------------------------- component tree --
|
|
48
45
|
// Live Todos widget, pinned ABOVE the chat input: a plain Container with
|
|
49
46
|
// auto height — it renders zero rows while empty and grows to its
|
|
@@ -176,9 +173,12 @@ export function startTui(options = {}) {
|
|
|
176
173
|
return;
|
|
177
174
|
themeRef = theme;
|
|
178
175
|
if (paintCanvas)
|
|
179
|
-
|
|
176
|
+
terminal.setCanvasBackground(ansiBg(theme.palette.canvas));
|
|
180
177
|
rebuildEditor();
|
|
181
|
-
|
|
178
|
+
// Forced full redraw: the diff renderer skips content-unchanged rows
|
|
179
|
+
// (blank fillers render as '' under both themes), which would leave
|
|
180
|
+
// them painted with the previous canvas color.
|
|
181
|
+
tui.requestRender(true);
|
|
182
182
|
},
|
|
183
183
|
setEditorAutocompleteProvider(provider) {
|
|
184
184
|
autocompleteProvider = provider;
|
package/lib/tui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,MAAM,GAGP,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAoC,MAAM,aAAa,CAAA;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAuC,MAAM,kBAAkB,CAAA;AAqE3G,MAAM,UAAU,QAAQ,CAAC,UAA2B,EAAE;IACpD,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"tui.js","sourceRoot":"","sources":["../src/tui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;A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AC,WAAW,KAAK,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;YAC7B,CAAC;iBAAM,IAAI,MAAM,CAAC,IAAI,KAAK,eAAe,IAAI,MAAM,CAAC,IAAI,KAAK,cAAc;mBACvE,MAAM,CAAC,IAAI,KAAK,aAAa,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,EAAE,CAAC;gBACpE,mEAAmE;gBACnE,wEAAwE;gBACxE,sEAAsE;gBACtE,gDAAgD;gBAChD,MAAM,CAAC,OAAO,EAAE,CAAA;gBAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IACxD,CAAC,CAAC,CAAA;IAEF,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAEvB,IAAI,CAAC;QACH,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gEAAgE;QAChE,IAAI,CAAC;YAAC,GAAG,CAAC,IAAI,EAAE,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAA;IACb,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiwayds/dsh-tui-pi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "pi-style terminal UI for DeepSeek Harness (dsh) — pi-tui look & feel, dsh slash commands, GitHub light/dark themes, powerline footer",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"lib",
|
|
31
31
|
"bin",
|
|
32
32
|
"cordis.patch.yml",
|
|
33
|
-
"patches",
|
|
34
33
|
"scripts",
|
|
35
34
|
"templates",
|
|
36
35
|
"README.md",
|
package/scripts/dev-install.mjs
CHANGED
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
* The profile's package.json must declare BOTH keys pointing at the tarball:
|
|
20
20
|
* "dsh-tui-pi": "file:<repo>/<name>-<version>.tgz" (bundle resolution)
|
|
21
21
|
* "@aiwayds/dsh-tui-pi": "file:<repo>/<name>-<version>.tgz" (loader import)
|
|
22
|
-
* and pnpm-workspace.yaml must carry the pi-tui patchedDependencies (see
|
|
23
|
-
* ~/.dsh/profiles/tui/pnpm-workspace.yaml).
|
|
24
22
|
*
|
|
25
23
|
* After installing: restart dsh (or /reload inside the TUI) to load the new
|
|
26
24
|
* copy.
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
diff --git a/dist/components/editor.d.ts b/dist/components/editor.d.ts
|
|
2
|
-
index a6fedc9e3b36d066e34860d040db6df47d88c432..f4d9afd8bc64f5ce5aafa06bb1aa8db3338c4f7d 100644
|
|
3
|
-
--- a/dist/components/editor.d.ts
|
|
4
|
-
+++ b/dist/components/editor.d.ts
|
|
5
|
-
@@ -24,6 +24,8 @@ export interface TextChunk {
|
|
6
|
-
export declare function wordWrapLine(line: string, maxWidth: number, preSegmented?: Intl.SegmentData[]): TextChunk[];
|
|
7
|
-
export interface EditorTheme {
|
|
8
|
-
borderColor: (str: string) => string;
|
|
9
|
-
+ /** Optional style for the editor's input text rows. Absent → the terminal default foreground is used (invisible on an app-painted dark canvas). */
|
|
10
|
-
+ textColor?: (str: string) => string;
|
|
11
|
-
selectList: SelectListTheme;
|
|
12
|
-
}
|
|
13
|
-
export interface EditorOptions {
|
|
14
|
-
diff --git a/dist/components/editor.js b/dist/components/editor.js
|
|
15
|
-
index 4786b46932b65785cfbd2304610ca77ccead910a..93c5f7e1596a0b567cf9fc59600c16596a60e567 100644
|
|
16
|
-
--- a/dist/components/editor.js
|
|
17
|
-
+++ b/dist/components/editor.js
|
|
18
|
-
@@ -433,13 +433,13 @@ export class Editor {
|
|
19
|
-
const afterGraphemes = [...this.segment(after, "grapheme")];
|
|
20
|
-
const firstGrapheme = afterGraphemes[0]?.segment || "";
|
|
21
|
-
const restAfter = after.slice(firstGrapheme.length);
|
|
22
|
-
- const cursor = `\x1b[7m${firstGrapheme}\x1b[0m`;
|
|
23
|
-
+ const cursor = `\x1b[7m${firstGrapheme}\x1b[27m`;
|
|
24
|
-
displayText = before + marker + cursor + restAfter;
|
|
25
|
-
// lineVisibleWidth stays the same - we're replacing, not adding
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
// Cursor is at the end - add highlighted space
|
|
29
|
-
- const cursor = "\x1b[7m \x1b[0m";
|
|
30
|
-
+ const cursor = "\x1b[7m \x1b[27m";
|
|
31
|
-
displayText = before + marker + cursor;
|
|
32
|
-
lineVisibleWidth = lineVisibleWidth + 1;
|
|
33
|
-
// If cursor overflows content width into the padding, flag it
|
|
34
|
-
@@ -451,8 +451,14 @@ export class Editor {
|
|
35
|
-
// Calculate padding based on actual visible width
|
|
36
|
-
const padding = " ".repeat(Math.max(0, contentWidth - lineVisibleWidth));
|
|
37
|
-
const lineRightPadding = cursorInPadding ? rightPadding.slice(1) : rightPadding;
|
|
38
|
-
- // Render the line (no side borders, just horizontal lines above and below)
|
|
39
|
-
- result.push(`${leftPadding}${displayText}${padding}${lineRightPadding}`);
|
|
40
|
-
+ // Render the line (no side borders, just horizontal lines above and below).
|
|
41
|
-
+ // The theme's optional textColor styles the input rows — without it they
|
|
42
|
-
+ // fall back to the terminal default foreground, which is invisible on an
|
|
43
|
-
+ // app-painted dark canvas. Applied per line; the cursor's reverse-video
|
|
44
|
-
+ // closes with ESC[27m (reverse off, not full reset) so the themed
|
|
45
|
-
+ // foreground survives past a mid-text cursor.
|
|
46
|
-
+ const styledText = this.theme.textColor ? this.theme.textColor(displayText) : displayText;
|
|
47
|
-
+ result.push(`${leftPadding}${styledText}${padding}${lineRightPadding}`);
|
|
48
|
-
}
|
|
49
|
-
// Render bottom border (with scroll indicator if more content below)
|
|
50
|
-
const linesBelow = layoutLines.length - (this.scrollOffset + visibleLines.length);
|
|
51
|
-
@@ -463,14 +469,20 @@ export class Editor {
|
|
52
|
-
else {
|
|
53
|
-
result.push(horizontal.repeat(width));
|
|
54
|
-
}
|
|
55
|
-
- // Add autocomplete list if active
|
|
56
|
-
+ // Add autocomplete list if active — inside a full box (┌─┐ rows)
|
|
57
|
-
if (this.autocompleteState && this.autocompleteList) {
|
|
58
|
-
- const autocompleteResult = this.autocompleteList.render(contentWidth);
|
|
59
|
-
+ const boxInnerWidth = Math.max(1, contentWidth - 2);
|
|
60
|
-
+ const autocompleteResult = this.autocompleteList.render(boxInnerWidth);
|
|
61
|
-
+ result.push(`${leftPadding}${this.borderColor(`┌${"─".repeat(boxInnerWidth)}┐`)}${rightPadding}`);
|
|
62
|
-
for (const line of autocompleteResult) {
|
|
63
|
-
const lineWidth = visibleWidth(line);
|
|
64
|
-
- const linePadding = " ".repeat(Math.max(0, contentWidth - lineWidth));
|
|
65
|
-
- result.push(`${leftPadding}${line}${linePadding}${rightPadding}`);
|
|
66
|
-
+ const linePadding = " ".repeat(Math.max(0, boxInnerWidth - lineWidth));
|
|
67
|
-
+ // Strip trailing RESETs so the row's own backdrop SGR bleeds
|
|
68
|
-
+ // into the padding and the right side border (solid interior);
|
|
69
|
-
+ // the reset before rightPadding keeps the editor margin clear.
|
|
70
|
-
+ result.push(`${leftPadding}│${line.replace(/(?:\x1b\[0m)+$/, "")}${linePadding}│\x1b[0m${rightPadding}`);
|
|
71
|
-
}
|
|
72
|
-
+ result.push(`${leftPadding}${this.borderColor(`└${"─".repeat(boxInnerWidth)}┘`)}${rightPadding}`);
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
diff --git a/dist/components/select-list.d.ts b/dist/components/select-list.d.ts
|
|
77
|
-
index d507de4ebff8e7fbaacd089677099c63b4dfff6c..4b8a374cd1db0544a11082f8008f73f8eb8d7ede 100644
|
|
78
|
-
--- a/dist/components/select-list.d.ts
|
|
79
|
-
+++ b/dist/components/select-list.d.ts
|
|
80
|
-
@@ -10,6 +10,8 @@ export interface SelectListTheme {
|
|
81
|
-
description: (text: string) => string;
|
|
82
|
-
scrollInfo: (text: string) => string;
|
|
83
|
-
noMatch: (text: string) => string;
|
|
84
|
-
+ /** Style hook for unselected rows (plain rows render without any theme call upstream). */
|
|
85
|
-
+ unselectedText?: (text: string) => string;
|
|
86
|
-
}
|
|
87
|
-
export interface SelectListTruncatePrimaryContext {
|
|
88
|
-
text: string;
|
|
89
|
-
diff --git a/dist/components/select-list.js b/dist/components/select-list.js
|
|
90
|
-
index 2e9231150951c3d3f3e13ac8ae8d623f06d38d5d..d5c8859ecd08fe4eccdc3cfca8ac7a3226f8fcb5 100644
|
|
91
|
-
--- a/dist/components/select-list.js
|
|
92
|
-
+++ b/dist/components/select-list.js
|
|
93
|
-
@@ -101,18 +101,21 @@ export class SelectList {
|
|
94
|
-
if (remainingWidth > MIN_DESCRIPTION_WIDTH) {
|
|
95
|
-
const truncatedDesc = truncateToWidth(descriptionSingleLine, remainingWidth, "");
|
|
96
|
-
if (isSelected) {
|
|
97
|
-
- return this.theme.selectedText(`${prefix}${truncatedValue}${spacing}${truncatedDesc}`);
|
|
98
|
-
+ // selectedPrefix is otherwise dead in renderItem: style the
|
|
99
|
-
+ // arrow accent, then the row text (concatenated, not nested —
|
|
100
|
-
+ // nesting would let the prefix's RESETs clear the row style).
|
|
101
|
-
+ return this.theme.selectedPrefix("") + this.theme.selectedText(`${truncatedValue}${spacing}${truncatedDesc}`);
|
|
102
|
-
}
|
|
103
|
-
const descText = this.theme.description(spacing + truncatedDesc);
|
|
104
|
-
- return prefix + truncatedValue + descText;
|
|
105
|
-
+ return (this.theme.unselectedText ?? ((t) => t))(prefix + truncatedValue) + descText;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const maxWidth = width - prefixWidth - 2;
|
|
109
|
-
const truncatedValue = this.truncatePrimary(item, isSelected, maxWidth, maxWidth);
|
|
110
|
-
if (isSelected) {
|
|
111
|
-
- return this.theme.selectedText(`${prefix}${truncatedValue}`);
|
|
112
|
-
+ return this.theme.selectedPrefix("") + this.theme.selectedText(`${truncatedValue}`);
|
|
113
|
-
}
|
|
114
|
-
- return prefix + truncatedValue;
|
|
115
|
-
+ return (this.theme.unselectedText ?? ((t) => t))(prefix + truncatedValue);
|
|
116
|
-
}
|
|
117
|
-
getPrimaryColumnWidth() {
|
|
118
|
-
const { min, max } = this.getPrimaryColumnBounds();
|
|
119
|
-
diff --git a/dist/index.d.ts b/dist/index.d.ts
|
|
120
|
-
index 50b5aeb61f12011642978bc2c31d8a2eb36d17d3..28b70df8001dc6b78056c408bdd6016f34f44e46 100644
|
|
121
|
-
--- a/dist/index.d.ts
|
|
122
|
-
+++ b/dist/index.d.ts
|
|
123
|
-
@@ -25,7 +25,7 @@ export { ProcessTerminal, type Terminal } from "./terminal.ts";
|
|
124
|
-
export { parseOsc11BackgroundColor, parseTerminalColorSchemeReport, type RgbColor, type TerminalColorScheme, } from "./terminal-colors.ts";
|
|
125
|
-
export { allocateImageId, type CellDimensions, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getWebpDimensions, hyperlink, type ImageDimensions, type ImageProtocol, type ImageRenderOptions, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCellDimensions, type TerminalCapabilities, } from "./terminal-image.ts";
|
|
126
|
-
export { type Component, Container, CURSOR_MARKER, compositeTuiLine, type Focusable, isFocusable, isViewportTUI, type OverlayAnchor, type OverlayHandle, type OverlayMargin, type OverlayOptions, type OverlayUnfocusOptions, type SizeValue, type TUI, type TuiInputListener, type TuiInputListenerResult, type TuiMode, type TuiStopOptions, type ViewportTUI, } from "./tui.ts";
|
|
127
|
-
-export { TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
|
|
128
|
-
+export { paintCanvasRow, TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
|
|
129
|
-
export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
|
|
130
|
-
export { getOsc8LinkAtColumn, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
|
|
131
|
-
//# sourceMappingURL=index.d.ts.map
|
|
132
|
-
|
|
133
|
-
diff --git a/dist/index.js b/dist/index.js
|
|
134
|
-
index 97acf774699dded9c5e490f2441a93ec05b73be5..80a1abf6ac515c4df22e3bf78fc0504d50ad6dd4 100644
|
|
135
|
-
--- a/dist/index.js
|
|
136
|
-
+++ b/dist/index.js
|
|
137
|
-
@@ -35,7 +35,7 @@ export { parseOsc11BackgroundColor, parseTerminalColorSchemeReport, } from "./te
|
|
138
|
-
// Terminal image support
|
|
139
|
-
export { allocateImageId, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getWebpDimensions, hyperlink, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCellDimensions, } from "./terminal-image.js";
|
|
140
|
-
export { Container, CURSOR_MARKER, compositeTuiLine, isFocusable, isViewportTUI, } from "./tui.js";
|
|
141
|
-
-export { TuiAltScreen } from "./tui-alt-screen.js";
|
|
142
|
-
+export { paintCanvasRow, TuiAltScreen } from "./tui-alt-screen.js";
|
|
143
|
-
export { TuiMainScreen } from "./tui-main-screen.js";
|
|
144
|
-
// Utilities
|
|
145
|
-
export { getOsc8LinkAtColumn, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.js";
|
|
146
|
-
diff --git a/dist/tui-alt-screen.d.ts b/dist/tui-alt-screen.d.ts
|
|
147
|
-
index 848119411c1ff2885b8d1efe97f2f297bd4cd470..96422839632a71e6382a1fc6fcd9b43e7b435609 100644
|
|
148
|
-
--- a/dist/tui-alt-screen.d.ts
|
|
149
|
-
+++ b/dist/tui-alt-screen.d.ts
|
|
150
|
-
@@ -1,5 +1,11 @@
|
|
151
|
-
import type { Terminal } from "./terminal.ts";
|
|
152
|
-
import { type Component, TuiBase, type TuiStopOptions, VIEWPORT_TUI, type ViewportTUI } from "./tui.ts";
|
|
153
|
-
+/**
|
|
154
|
-
+ * Paint one screen row with a canvas background SGR: prefix the row with the
|
|
155
|
-
+ * bg code, re-inject it after every SGR that clears the background, and pad
|
|
156
|
-
+ * to the full row width so the erase-line remainder carries the color too.
|
|
157
|
-
+ */
|
|
158
|
-
+export declare function paintCanvasRow(line: string, background: string, width: number): string;
|
|
159
|
-
export interface TuiAltScreenOptions {
|
|
160
|
-
/** Number of logical lines moved for each mouse-wheel event. */
|
|
161
|
-
wheelScrollLines?: number;
|
|
162
|
-
@@ -57,11 +63,20 @@ export declare class TuiAltScreen extends TuiBase implements ViewportTUI {
|
|
163
|
-
private readonly openUrl?;
|
|
164
|
-
private readonly onRightClickPaste?;
|
|
165
|
-
private readonly copySelection?;
|
|
166
|
-
+ private canvasBackground?;
|
|
167
|
-
constructor(terminal: Terminal, showHardwareCursor?: boolean, logDirectory?: string, options?: TuiAltScreenOptions);
|
|
168
|
-
get viewportTop(): number;
|
|
169
|
-
get isFollowingOutput(): boolean;
|
|
170
|
-
setLayoutRoot(component: Component | undefined): void;
|
|
171
|
-
render(width: number): string[];
|
|
172
|
-
+ /**
|
|
173
|
-
+ * Paint every rendered row with a canvas background SGR (e.g.
|
|
174
|
-
+ * "\x1b[48;2;13;17;23m"). `undefined` restores the transparent default
|
|
175
|
-
+ * (the terminal background shows through). The code is re-injected after
|
|
176
|
-
+ * every SGR that clears the background and rows are padded to the full
|
|
177
|
-
+ * width, so the whole screen carries the color — image rows excepted.
|
|
178
|
-
+ */
|
|
179
|
-
+ setCanvasBackground(background: string | undefined): void;
|
|
180
|
-
protected getMountedRoots(): readonly Component[];
|
|
181
|
-
private getPrimaryScrollView;
|
|
182
|
-
protected beforeTerminalStart(): void;
|
|
183
|
-
diff --git a/dist/tui-alt-screen.js b/dist/tui-alt-screen.js
|
|
184
|
-
index 4edcf845ba7866782a8ec7219508a2dce0073a91..338f2b29e7ba926399f3d663b0b79669c8ac6c13 100644
|
|
185
|
-
--- a/dist/tui-alt-screen.js
|
|
186
|
-
+++ b/dist/tui-alt-screen.js
|
|
187
|
-
@@ -21,6 +21,51 @@ const END_SYNCHRONIZED_OUTPUT = "\x1b[?2026l";
|
|
188
|
-
const OSC133_ZONE_PREFIX = /^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/;
|
|
189
|
-
const OSC133_PROMPT_START = /^\x1b\]133;A(?:\x07|\x1b\\)/;
|
|
190
|
-
const PAGE_SCROLL_OVERLAP = 4;
|
|
191
|
-
+const CSI_PATTERN = /\x1b\[[0-9;:]*[A-Za-z]/g;
|
|
192
|
-
+/**
|
|
193
|
-
+ * True when an SGR sequence resets the background to the terminal default:
|
|
194
|
-
+ * a full reset (empty params or param 0) or the explicit default-bg param 49.
|
|
195
|
-
+ * Intentional background sets (48/4…, 48;2;…) do not clear, so they win.
|
|
196
|
-
+ */
|
|
197
|
-
+function sgrClearsBackground(sequence) {
|
|
198
|
-
+ const params = sequence.slice(2, -1);
|
|
199
|
-
+ if (params === "") return true;
|
|
200
|
-
+ // A color-set (3x foreground / 4x background — ANSI 30-37/40-47, truecolor
|
|
201
|
-
+ // 38;2/48;2, 256-color 38;5/48;5) never clears the background, even when a
|
|
202
|
-
+ // channel is 0: 48;2;0;121;107 (teal) would otherwise read the 0 as the
|
|
203
|
-
+ // reset param and re-inject the canvas over the segment. (49 alone — bg →
|
|
204
|
-
+ // default — IS a clear and falls through to the loop below.)
|
|
205
|
-
+ if (/^(?:3[0-7]|38;|4[0-8]|48;)/.test(params)) return false;
|
|
206
|
-
+ for (const param of params.split(";")) {
|
|
207
|
-
+ const code = param === "" ? 0 : Number.parseInt(param, 10);
|
|
208
|
-
+ if (Number.isNaN(code)) continue;
|
|
209
|
-
+ if (code === 0 || code === 49) return true;
|
|
210
|
-
+ }
|
|
211
|
-
+ return false;
|
|
212
|
-
+}
|
|
213
|
-
+/**
|
|
214
|
-
+ * Paint one screen row with a canvas background SGR: prefix the row with the
|
|
215
|
-
+ * bg code, re-inject it after every SGR that clears the background, and pad
|
|
216
|
-
+ * to the full row width so the erase-line remainder carries the color too.
|
|
217
|
-
+ * Image rows are the caller's responsibility (they must stay untouched).
|
|
218
|
-
+ */
|
|
219
|
-
+export function paintCanvasRow(line, background, width) {
|
|
220
|
-
+ let painted = background;
|
|
221
|
-
+ let last = 0;
|
|
222
|
-
+ for (const match of line.matchAll(CSI_PATTERN)) {
|
|
223
|
-
+ const sequence = match[0];
|
|
224
|
-
+ painted += line.slice(last, match.index);
|
|
225
|
-
+ painted += sequence;
|
|
226
|
-
+ if (sequence.endsWith("m") && sgrClearsBackground(sequence)) {
|
|
227
|
-
+ painted += background;
|
|
228
|
-
+ }
|
|
229
|
-
+ last = match.index + sequence.length;
|
|
230
|
-
+ }
|
|
231
|
-
+ painted += line.slice(last);
|
|
232
|
-
+ const pad = width - visibleWidth(line);
|
|
233
|
-
+ if (pad > 0) painted += " ".repeat(pad);
|
|
234
|
-
+ return `${painted}\x1b[0m`;
|
|
235
|
-
+}
|
|
236
|
-
const MAX_CACHED_OFFSCREEN_KITTY_IMAGES = 16;
|
|
237
|
-
const MAX_CACHED_OFFSCREEN_KITTY_TRANSMISSION_BYTES = 32 * 1024 * 1024;
|
|
238
|
-
const MAX_CACHED_OFFSCREEN_KITTY_DECODED_BYTES = 64 * 1024 * 1024;
|
|
239
|
-
@@ -64,6 +109,7 @@ export class TuiAltScreen extends TuiBase {
|
|
240
|
-
openUrl;
|
|
241
|
-
onRightClickPaste;
|
|
242
|
-
copySelection;
|
|
243
|
-
+ canvasBackground;
|
|
244
|
-
constructor(terminal, showHardwareCursor, logDirectory, options = {}) {
|
|
245
|
-
super(terminal, showHardwareCursor, logDirectory);
|
|
246
|
-
this.implicitDocument = {
|
|
247
|
-
@@ -100,6 +146,18 @@ export class TuiAltScreen extends TuiBase {
|
|
248
|
-
render(width) {
|
|
249
|
-
return this.layoutRoot?.render(width) ?? super.render(width);
|
|
250
|
-
}
|
|
251
|
-
+ /**
|
|
252
|
-
+ * Paint every rendered row with a canvas background SGR (e.g.
|
|
253
|
-
+ * "\x1b[48;2;13;17;23m"). `undefined` restores the transparent default
|
|
254
|
-
+ * (the terminal background shows through). The code is re-injected after
|
|
255
|
-
+ * every SGR that clears the background and rows are padded to the full
|
|
256
|
-
+ * width, so the whole screen carries the color — image rows excepted.
|
|
257
|
-
+ */
|
|
258
|
-
+ setCanvasBackground(background) {
|
|
259
|
-
+ if (this.canvasBackground === background) return;
|
|
260
|
-
+ this.canvasBackground = background;
|
|
261
|
-
+ this.requestRender();
|
|
262
|
-
+ }
|
|
263
|
-
getMountedRoots() {
|
|
264
|
-
return this.layoutRoot ? [this.layoutRoot] : this.children;
|
|
265
|
-
}
|
|
266
|
-
@@ -1099,6 +1157,10 @@ export class TuiAltScreen extends TuiBase {
|
|
267
|
-
return line;
|
|
268
|
-
return sliceByColumn(line, 0, width, true);
|
|
269
|
-
});
|
|
270
|
-
+ if (this.canvasBackground !== undefined) {
|
|
271
|
-
+ const canvasBackground = this.canvasBackground;
|
|
272
|
-
+ screen = screen.map((line) => (isImageLine(line) ? line : paintCanvasRow(line, canvasBackground, width)));
|
|
273
|
-
+ }
|
|
274
|
-
const fullRedraw = this.previousScreen.length === 0 || this.previousScreenWidth !== width || this.previousScreenHeight !== height;
|
|
275
|
-
const imagesNeedRedraw = screen.some((line, row) => line !== this.previousScreen[row] && (isImageLine(line) || isImageLine(this.previousScreen[row] ?? "")));
|
|
276
|
-
const redrawImages = fullRedraw || imagesNeedRedraw;
|