WidthMeasurements class final
What the terminal ACTUALLY drew for each battery glyph, in cells, measured rather than assumed — raw observations, parallel to widthProbeBattery.
There is no protocol by which an application can ask a terminal how wide it
will draw something — DECRQM 2027 reports a capability that is known to lie
in both directions, and OSC 66 exists on two emulators. What does work,
everywhere, is what vim's t_u7 does: draw it and look at where the cursor
ended up.
The batch is atomic (RFC 0019 §6.1): CPR replies are ordered but unlabeled, so a reply count that doesn't match the battery means later replies can't be attributed safely — the whole battery is discarded (WidthMeasurements.empty) rather than salvaged per-glyph. Judgement (agreement, anomaly rejection) lives in derivation, not here: a measured zero advance is recorded as 0 and fails agreement downstream.
- Annotations
-
- @immutable
Constructors
-
WidthMeasurements(List<
int?> cellWidths) -
cellWidthsmust be parallel to widthProbeBattery (or empty).const - WidthMeasurements.empty()
-
No usable measurements: the terminal never answered, or the batch was
discarded as unattributable.
const
-
WidthMeasurements.of(Map<
String, int?> byId) -
Builds measurements from glyph
id→ width, for tests and fixtures. Ids not mentioned measure null.factory
Properties
-
cellWidths
→ List<
int?> -
Measured advance in cells per battery glyph, or null where unanswered.
Empty when the whole batch was discarded.
final
-
entries
→ Iterable<
(WidthProbeGlyph, int?)> -
Battery glyphs paired with their measurements, for diagnostics.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
override
-
widthOf(
String id) → int? -
The measured width of the battery glyph with
id, or null. -
widthsIn(
WidthProbeClass probeClass) → List< int?> -
The measured widths of every representative in
probeClass, in battery order. Empty when the batch was discarded.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited