Skip to content
ConsoleMonster

API Reference

Class

TerminalWidthProbe

Namespace ConsoleMonster.Output
Assembly ConsoleMonster
Modifiers static

Measures how wide the current interactive terminal draws emoji, ZWJ sequences, flags, CJK and East Asian Ambiguous characters, by writing a small sample set and reading the cursor column back from the console screen buffer. A live session runs it once per process on the alternate screen, before its first frame, so the samples are never visible in scrollback. It never reads console input: the cursor position comes from GetConsoleScreenBufferInfo, which inside Windows Terminal (ConPTY) reports the same advances as the terminal's own cursor report.

Inheritance

  • Object
  • TerminalWidthProbe

Methods

public static Void Invalidate() #
Returns: Void

Forgets the cached measurement so the next call to TerminalWidthProbe.TryProbe measures again.

public static Boolean TryProbe(ITerminalWriter writer, TimeSpan timeout, out TerminalWidthProfile profile, out String decision) #
Returns: Boolean

Probes once per process through writer (the console writer the session draws with); later calls return the cached outcome. Call it only while the alternate screen is active: the probe writes on the current row and erases it afterwards.

Parameters

writer ConsoleMonster.Output.ITerminalWriter requiredposition: 0
The console writer; it must write UTF-16 to the console (not a code-page stream).
timeout System.TimeSpan requiredposition: 1
Overall time budget for the samples (about 300 ms is typical; measuring usually takes a few).
profile ConsoleMonster.Text.TerminalWidthProfile requiredposition: 2
The measured profile, or TerminalWidthProfile.Standard when probing failed.
decision System.String requiredposition: 3
A human-readable result or skip reason.

Returns

True when the sample set was measured.