@vincemakes/kiso-tui 0.15.6 → 0.15.7
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/dist/editor.d.ts +4 -0
- package/dist/editor.js +33 -3
- package/package.json +2 -2
package/dist/editor.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ export declare class Editor {
|
|
|
68
68
|
* over while the run is told to stop. Mirrors onEscape (a list, so
|
|
69
69
|
* listeners can coexist); the line arrives already gone from the
|
|
70
70
|
* composer, exactly as a submit's does. */
|
|
71
|
+
/** REL-0152-D11: what to do when a paste arrives empty. See
|
|
72
|
+
* #onEmptyPaste — the CLI owns the platform, the editor owns the
|
|
73
|
+
* moment. */
|
|
74
|
+
onEmptyPaste(cb: () => string | null): void;
|
|
71
75
|
onRedirect(cb: (line: string) => void): void;
|
|
72
76
|
/** W22: bind the pending-turn queue — the CLI's live slots. The ↑
|
|
73
77
|
* pop walks them (each pop leaves the queue, cancelling the turn);
|
package/dist/editor.js
CHANGED
|
@@ -153,6 +153,23 @@ export class Editor {
|
|
|
153
153
|
* reads, and this is a field, not a local.
|
|
154
154
|
*/
|
|
155
155
|
#pasteRun = null;
|
|
156
|
+
/**
|
|
157
|
+
* REL-0152-D11 — what an EMPTY paste means.
|
|
158
|
+
*
|
|
159
|
+
* Pasting an image sends nothing: a terminal has no way to put binary
|
|
160
|
+
* into a byte stream, so the bracketed paste arrives with no content.
|
|
161
|
+
* That emptiness is the signal — the user pressed paste and the
|
|
162
|
+
* terminal had nothing to hand over — and whatever they meant has to
|
|
163
|
+
* be fetched from the clipboard instead.
|
|
164
|
+
*
|
|
165
|
+
* The editor does not know what a clipboard is and must not: this
|
|
166
|
+
* package renders and reads keys, and reaching into the operating
|
|
167
|
+
* system from it would put a platform dependency under every gate in
|
|
168
|
+
* the suite. The CLI supplies the hook; the editor supplies the
|
|
169
|
+
* moment. It returns the text to insert (a path, for the CLI's
|
|
170
|
+
* attachment scan to pick up) or null when there was nothing.
|
|
171
|
+
*/
|
|
172
|
+
#onEmptyPaste = null;
|
|
156
173
|
/** TUI2-R3v2 ①: one-shot — a panel that just closed swallows the
|
|
157
174
|
* habitual trailing enter rather than submitting the restored draft. */
|
|
158
175
|
#swallowEnter = false;
|
|
@@ -282,6 +299,12 @@ export class Editor {
|
|
|
282
299
|
* over while the run is told to stop. Mirrors onEscape (a list, so
|
|
283
300
|
* listeners can coexist); the line arrives already gone from the
|
|
284
301
|
* composer, exactly as a submit's does. */
|
|
302
|
+
/** REL-0152-D11: what to do when a paste arrives empty. See
|
|
303
|
+
* #onEmptyPaste — the CLI owns the platform, the editor owns the
|
|
304
|
+
* moment. */
|
|
305
|
+
onEmptyPaste(cb) {
|
|
306
|
+
this.#onEmptyPaste = cb;
|
|
307
|
+
}
|
|
285
308
|
onRedirect(cb) {
|
|
286
309
|
this.#redirectCbs.push(cb);
|
|
287
310
|
}
|
|
@@ -1902,12 +1925,19 @@ export class Editor {
|
|
|
1902
1925
|
* operation in this file works on it without knowing it exists.
|
|
1903
1926
|
*/
|
|
1904
1927
|
#commitPaste() {
|
|
1905
|
-
|
|
1928
|
+
let run = this.#pasteRun ?? [];
|
|
1906
1929
|
const start = this.#pasteAt ?? this.#cursor;
|
|
1907
1930
|
this.#pasteRun = null;
|
|
1908
1931
|
this.#pasteAt = null;
|
|
1909
|
-
if (run.length === 0)
|
|
1910
|
-
|
|
1932
|
+
if (run.length === 0) {
|
|
1933
|
+
// REL-0152-D11: an empty paste is the image case — see
|
|
1934
|
+
// #onEmptyPaste. Anything it returns is ordinary text from here
|
|
1935
|
+
// on and takes the same route as if it had been typed.
|
|
1936
|
+
const substitute = this.#onEmptyPaste?.() ?? null;
|
|
1937
|
+
if (substitute === null || substitute === "")
|
|
1938
|
+
return;
|
|
1939
|
+
run = [...substitute].map((ch) => ch.codePointAt(0));
|
|
1940
|
+
}
|
|
1911
1941
|
if (this.#historyIdx !== null)
|
|
1912
1942
|
this.#historyIdx = null;
|
|
1913
1943
|
this.#queuePopMode = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-tui",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.7",
|
|
4
4
|
"description": "kiso tui \u2014 the pure terminal layer (cell renderer, dock, raw editor, diff, palette). Zero runtime dependencies: input is data, output is bytes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://github.com/vincemakes/kiso/tree/main/packages/tui#readme",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@vincemakes/kiso-tui-cells": "0.15.
|
|
38
|
+
"@vincemakes/kiso-tui-cells": "0.15.7"
|
|
39
39
|
}
|
|
40
40
|
}
|