terminfo.dev 0.3.0 → 0.5.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 +1 -1
- package/src/index.ts +9 -9
- package/src/probes/index.ts +23 -4
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -46,11 +46,6 @@ async function main() {
|
|
|
46
46
|
console.log(`Running ${ALL_PROBES.length} probes...\n`)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// Save/restore screen state
|
|
50
|
-
process.stdout.write("\x1b7") // save cursor
|
|
51
|
-
process.stdout.write("\x1b[?1049h") // alt screen
|
|
52
|
-
process.stdout.write("\x1b[2J\x1b[H") // clear + home
|
|
53
|
-
|
|
54
49
|
const results: Record<string, boolean> = {}
|
|
55
50
|
const notes: Record<string, string> = {}
|
|
56
51
|
const responses: Record<string, string> = {}
|
|
@@ -58,7 +53,13 @@ async function main() {
|
|
|
58
53
|
let failed = 0
|
|
59
54
|
|
|
60
55
|
await withRawMode(async () => {
|
|
56
|
+
// Enter alt screen inside raw mode so all probe output stays contained
|
|
57
|
+
process.stdout.write("\x1b[?1049h") // alt screen
|
|
58
|
+
process.stdout.write("\x1b[2J\x1b[H") // clear + home
|
|
59
|
+
|
|
61
60
|
for (const probe of ALL_PROBES) {
|
|
61
|
+
// Clear screen before each probe to prevent leaking output
|
|
62
|
+
process.stdout.write("\x1b[2J\x1b[H")
|
|
62
63
|
try {
|
|
63
64
|
const result = await probe.run()
|
|
64
65
|
results[probe.id] = result.pass
|
|
@@ -72,11 +73,10 @@ async function main() {
|
|
|
72
73
|
failed++
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
})
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
// Exit alt screen while still in raw mode
|
|
78
|
+
process.stdout.write("\x1b[?1049l")
|
|
79
|
+
})
|
|
80
80
|
|
|
81
81
|
const total = ALL_PROBES.length
|
|
82
82
|
const pct = Math.round((passed / total) * 100)
|
package/src/probes/index.ts
CHANGED
|
@@ -316,9 +316,9 @@ const kittyKeyboard: Probe = {
|
|
|
316
316
|
},
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
const
|
|
320
|
-
id: "extensions.sixel",
|
|
321
|
-
name: "Sixel
|
|
319
|
+
const sixelDA1: Probe = {
|
|
320
|
+
id: "extensions.sixel-da1",
|
|
321
|
+
name: "Sixel advertised (DA1 bit 4)",
|
|
322
322
|
async run() {
|
|
323
323
|
const match = await query("\x1b[c", /\x1b\[\?([0-9;]+)c/, 1000)
|
|
324
324
|
if (!match) return { pass: false, note: "No DA1 response" }
|
|
@@ -332,6 +332,24 @@ const sixelSupport: Probe = {
|
|
|
332
332
|
},
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
const sixelRender: Probe = {
|
|
336
|
+
id: "extensions.sixel",
|
|
337
|
+
name: "Sixel graphics (render)",
|
|
338
|
+
async run() {
|
|
339
|
+
// Send a minimal sixel image and check if cursor moved
|
|
340
|
+
process.stdout.write("\x1b[1;1H") // move to 1;1
|
|
341
|
+
process.stdout.write("\x1bPq#0;2;0;0;0~-~\x1b\\") // tiny 1x2 sixel
|
|
342
|
+
const pos = await queryCursorPosition()
|
|
343
|
+
if (!pos) return { pass: false, note: "No cursor response after sixel" }
|
|
344
|
+
// If terminal parsed sixel, cursor should have moved
|
|
345
|
+
const moved = pos[0] > 1 || pos[1] > 1
|
|
346
|
+
return {
|
|
347
|
+
pass: moved,
|
|
348
|
+
note: moved ? undefined : "Sixel image didn't move cursor",
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
}
|
|
352
|
+
|
|
335
353
|
const osc52Clipboard: Probe = {
|
|
336
354
|
id: "extensions.osc52-clipboard",
|
|
337
355
|
name: "Clipboard query (OSC 52)",
|
|
@@ -449,7 +467,8 @@ export const ALL_PROBES: Probe[] = [
|
|
|
449
467
|
|
|
450
468
|
// Extensions
|
|
451
469
|
kittyKeyboard,
|
|
452
|
-
|
|
470
|
+
sixelDA1,
|
|
471
|
+
sixelRender,
|
|
453
472
|
osc52Clipboard,
|
|
454
473
|
osc7Cwd,
|
|
455
474
|
|