Skip to content

@jsvision/core / warnIfAmbiguousWide

Function: warnIfAmbiguousWide()

warnIfAmbiguousWide(query, options?): Promise<WidthProbeResult>

Defined in: host/width-probe.ts:404

Probe the terminal for double-width chrome glyphs and, if a group is wide, emit one warning line. Meant to run once at startup on a real TTY in raw mode, before entering the alternate screen. A silent or non-TTY terminal produces no warning. Returns the probe result too, so you can also adapt your render caps.

Parameters

query

TerminalQuery

The terminal to probe.

options?

WidthWarnOptions = {}

Probe overrides, an optional warn sink (default: one line to stderr), and the adapted flag, which selects the "adapted automatically" wording.

Returns

Promise<WidthProbeResult>

The WidthProbeResult.

Example

ts
import { createTerminalQuery, warnIfAmbiguousWide, degradeCapsForWidth } from '@jsvision/core';

const query = createTerminalQuery();
try {
  // Warn the user, and adapt render caps in one probe run.
  const result = await warnIfAmbiguousWide(query, { adapted: true });
  const renderCaps = degradeCapsForWidth(caps, result);
} finally {
  query.close();
}