terminfo.dev 1.6.0 → 1.6.2
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 +16 -4
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -62,9 +62,12 @@ async function runProbes(): Promise<ProbeResults> {
|
|
|
62
62
|
let passed = 0
|
|
63
63
|
|
|
64
64
|
await withRawMode(async () => {
|
|
65
|
-
|
|
65
|
+
// Use alt screen to contain all probe output
|
|
66
|
+
process.stdout.write("\x1b[?1049h")
|
|
67
|
+
|
|
66
68
|
for (const probe of ALL_PROBES) {
|
|
67
|
-
|
|
69
|
+
// Reset SGR + clear screen before each probe
|
|
70
|
+
process.stdout.write("\x1b[0m\x1b[2J\x1b[H")
|
|
68
71
|
try {
|
|
69
72
|
const result = await probe.run()
|
|
70
73
|
results[probe.id] = result.pass
|
|
@@ -75,16 +78,25 @@ async function runProbes(): Promise<ProbeResults> {
|
|
|
75
78
|
results[probe.id] = false
|
|
76
79
|
notes[probe.id] = `error: ${err instanceof Error ? err.message : String(err)}`
|
|
77
80
|
}
|
|
81
|
+
// Reset SGR after each probe to prevent style leaking
|
|
82
|
+
process.stdout.write("\x1b[0m")
|
|
78
83
|
}
|
|
79
|
-
|
|
84
|
+
|
|
85
|
+
// Clean up alt screen completely before switching back
|
|
86
|
+
process.stdout.write("\x1b[0m") // reset SGR
|
|
87
|
+
process.stdout.write("\x1b[?7h") // re-enable auto-wrap (DECAWM)
|
|
88
|
+
process.stdout.write("\x1b[?25h") // show cursor (DECTCEM)
|
|
89
|
+
process.stdout.write("\x1b[r") // reset scroll region (DECSTBM)
|
|
80
90
|
await drainStdin(500)
|
|
81
|
-
process.stdout.write("\x1b[?1049l")
|
|
91
|
+
process.stdout.write("\x1b[?1049l") // exit alt screen
|
|
82
92
|
})
|
|
83
93
|
|
|
84
94
|
return { terminal, results, notes, responses, passed, total: ALL_PROBES.length }
|
|
85
95
|
}
|
|
86
96
|
|
|
87
97
|
function printHeader(terminal: ReturnType<typeof detectTerminal>) {
|
|
98
|
+
// Reset ALL SGR on main screen — probes may have left underline/style active
|
|
99
|
+
process.stdout.write("\x1b[0m\x1b[24m\x1b[4:0m\x1b[59m\x1b[55m\x1b[29m\x1b[28m\x1b[27m\x1b[25m\x1b[23m\x1b[22m")
|
|
88
100
|
const siteLink = link("https://terminfo.dev", "terminfo.dev")
|
|
89
101
|
console.log(`\x1b[1m${siteLink}\x1b[0m — can your terminal do that?\n`)
|
|
90
102
|
console.log(` Terminal: \x1b[1m${terminal.name}\x1b[0m${terminal.version ? ` ${terminal.version}` : ""}`)
|