terminfo.dev 1.6.2 → 1.7.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +10 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminfo.dev",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "Test your terminal's feature support and contribute to terminfo.dev",
5
5
  "keywords": [
6
6
  "ansi",
package/src/index.ts CHANGED
@@ -61,13 +61,11 @@ async function runProbes(): Promise<ProbeResults> {
61
61
  const responses: Record<string, string> = {}
62
62
  let passed = 0
63
63
 
64
- await withRawMode(async () => {
65
- // Use alt screen to contain all probe output
66
- process.stdout.write("\x1b[?1049h")
64
+ // Save cursor + scroll position, run probes, restore
65
+ process.stdout.write("\x1b7") // save cursor (DECSC)
67
66
 
67
+ await withRawMode(async () => {
68
68
  for (const probe of ALL_PROBES) {
69
- // Reset SGR + clear screen before each probe
70
- process.stdout.write("\x1b[0m\x1b[2J\x1b[H")
71
69
  try {
72
70
  const result = await probe.run()
73
71
  results[probe.id] = result.pass
@@ -78,25 +76,19 @@ async function runProbes(): Promise<ProbeResults> {
78
76
  results[probe.id] = false
79
77
  notes[probe.id] = `error: ${err instanceof Error ? err.message : String(err)}`
80
78
  }
81
- // Reset SGR after each probe to prevent style leaking
82
- process.stdout.write("\x1b[0m")
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)
90
- await drainStdin(500)
91
- process.stdout.write("\x1b[?1049l") // exit alt screen
80
+ await drainStdin(1000)
92
81
  })
93
82
 
83
+ // Restore terminal state completely
84
+ process.stdout.write("\x1b8") // restore cursor (DECRC)
85
+ process.stdout.write("\x1bc") // RIS — full terminal reset
86
+ // RIS moves cursor to 1,1 — that's fine, we're about to print results
87
+
94
88
  return { terminal, results, notes, responses, passed, total: ALL_PROBES.length }
95
89
  }
96
90
 
97
91
  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")
100
92
  const siteLink = link("https://terminfo.dev", "terminfo.dev")
101
93
  console.log(`\x1b[1m${siteLink}\x1b[0m — can your terminal do that?\n`)
102
94
  console.log(` Terminal: \x1b[1m${terminal.name}\x1b[0m${terminal.version ? ` ${terminal.version}` : ""}`)
@@ -223,7 +215,7 @@ program
223
215
  notes: data.notes,
224
216
  responses: data.responses,
225
217
  generated: new Date().toISOString(),
226
- cliVersion: "1.6.0",
218
+ cliVersion: "1.7.0",
227
219
  probeCount: ALL_PROBES.length,
228
220
  })
229
221
  if (url) {