ADR 0002: One width method per process
- Status: Accepted, 2026-11-29 (decision D13 of the implementation plan)
Context
Bubble Tea measures text two ways: grapheme clusters (the default, GraphemeWidth) or code points as wcwidth does (WcWidth, for terminals that measure that way). The renderer, the layout helpers in tea::style and every component measure text, and they must agree, or a frame is drawn with cells the terminal does not have.
Decision
The width method is set once per process and read wherever text is measured. It is not passed through View.
Consequences
- Layout helpers, components and the renderer cannot disagree.
- Two programs could not use different width methods at the same time; petitcarnets already refuses a second program holding the terminal while one does.
- Tests that need the other method set it for the whole test binary (
tests/width_method.rsis its own binary for this reason).