@f5xc-salesdemos/pi-tui 19.27.0 → 19.28.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/package.json +3 -3
- package/src/terminal.ts +29 -25
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5xc-salesdemos/pi-tui",
|
|
4
|
-
"version": "19.
|
|
4
|
+
"version": "19.28.0",
|
|
5
5
|
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
|
|
6
6
|
"homepage": "https://github.com/f5xc-salesdemos/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"fmt": "biome format --write ."
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@f5xc-salesdemos/pi-natives": "19.
|
|
41
|
-
"@f5xc-salesdemos/pi-utils": "19.
|
|
40
|
+
"@f5xc-salesdemos/pi-natives": "19.28.0",
|
|
41
|
+
"@f5xc-salesdemos/pi-utils": "19.28.0",
|
|
42
42
|
"marked": "^17.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
package/src/terminal.ts
CHANGED
|
@@ -264,41 +264,33 @@ export class ProcessTerminal implements Terminal {
|
|
|
264
264
|
|
|
265
265
|
// Forward individual sequences to the input handler
|
|
266
266
|
this.#stdinBuffer.on("data", (sequence: string) => {
|
|
267
|
-
//
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (
|
|
267
|
+
// Kitty protocol response — always swallow, enable protocol on first match
|
|
268
|
+
const kittyMatch = sequence.match(kittyResponsePattern);
|
|
269
|
+
if (kittyMatch) {
|
|
270
|
+
if (!this.#kittyProtocolActive) {
|
|
271
271
|
if (this.#modifyOtherKeysTimeout) {
|
|
272
272
|
clearTimeout(this.#modifyOtherKeysTimeout);
|
|
273
273
|
this.#modifyOtherKeysTimeout = undefined;
|
|
274
274
|
}
|
|
275
275
|
this.#kittyProtocolActive = true;
|
|
276
276
|
setKittyProtocolActive(true);
|
|
277
|
-
|
|
278
|
-
// Enable Kitty keyboard protocol (push flags)
|
|
279
|
-
// Flag 1 = disambiguate escape codes
|
|
280
|
-
// Flag 2 = report event types (press/repeat/release)
|
|
281
|
-
// Flag 4 = report alternate keys
|
|
282
277
|
this.#safeWrite("\x1b[>7u");
|
|
283
|
-
return; // Don't forward protocol response to TUI
|
|
284
278
|
}
|
|
279
|
+
return;
|
|
285
280
|
}
|
|
286
281
|
|
|
287
|
-
// DA1 response
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
this.#
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
if (this.#osc11QueryQueued && !this.#dead) {
|
|
300
|
-
this.#osc11QueryQueued = false;
|
|
301
|
-
this.#startOsc11Query();
|
|
282
|
+
// DA1 response — always swallow; manage sentinel count if pending
|
|
283
|
+
if (da1ResponsePattern.test(sequence)) {
|
|
284
|
+
if (this.#pendingDa1Sentinels > 0) {
|
|
285
|
+
this.#pendingDa1Sentinels--;
|
|
286
|
+
if (this.#osc11Pending) {
|
|
287
|
+
this.#osc11Pending = false;
|
|
288
|
+
this.#osc11ResponseBuffer = "";
|
|
289
|
+
}
|
|
290
|
+
if (this.#osc11QueryQueued && !this.#dead) {
|
|
291
|
+
this.#osc11QueryQueued = false;
|
|
292
|
+
this.#startOsc11Query();
|
|
293
|
+
}
|
|
302
294
|
}
|
|
303
295
|
return;
|
|
304
296
|
}
|
|
@@ -339,6 +331,18 @@ export class ProcessTerminal implements Terminal {
|
|
|
339
331
|
}, 100);
|
|
340
332
|
return;
|
|
341
333
|
}
|
|
334
|
+
// Drop stale terminal responses that leaked through the stdin buffer
|
|
335
|
+
// timeout flush. These are incomplete DA1/DA2 replies, OSC 11
|
|
336
|
+
// fragments, or Kitty protocol responses that arrived split across
|
|
337
|
+
// data events and were flushed before their terminator arrived.
|
|
338
|
+
if (
|
|
339
|
+
/^\x1b\[\?[\d;]*[a-z]?$/i.test(sequence) || // DA1/Kitty responses: ESC[?...
|
|
340
|
+
/^\x1b\](?:11|10|4);/.test(sequence) || // OSC color responses without terminator
|
|
341
|
+
/^\x1b\[>[\d;]*[a-z]?$/i.test(sequence) // DA2 responses: ESC[>...
|
|
342
|
+
) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
|
|
342
346
|
if (this.#inputHandler) {
|
|
343
347
|
this.#inputHandler(sequence);
|
|
344
348
|
}
|