@jsvision/core / probeAmbiguousWidth
Function: probeAmbiguousWidth()
probeAmbiguousWidth(
query,options?):Promise<WidthProbeResult>
Defined in: host/width-probe.ts:231
Measure how many columns each probe group advances on the live terminal.
Writes CR + arrows + DSR + CR + boxes + DSR, reads both CPR replies under one bounded timeout, then erases the probe artifact. Always resolves, never rejects: a throwing write/read, a silent terminal (timeout), a single-group reply, or an oversized reply all yield probed:false with both groups unmeasured.
Parameters
query
The terminal to probe (a real TTY-backed query or a test double).
options?
WidthProbeOptions = {}
Per-group probe strings + shared timeout overrides.
Returns
Promise<WidthProbeResult>
The WidthProbeResult; probed: false if the terminal did not answer.
Example
ts
import { createTerminalQuery, probeAmbiguousWidth } from '@jsvision/core';
// On a real TTY in raw mode, before entering the alternate screen:
const query = createTerminalQuery();
try {
const result = await probeAmbiguousWidth(query);
if (result.probed && (result.arrows.wide || result.boxes.wide)) {
console.error('terminal renders chrome glyphs double-width');
}
} finally {
query.close();
}