module TermBuf::Unicode::WidthOverrides

Overview

The TERMBUF_WIDTHS escape hatch, which has the last word over whatever the terminal said when it was measured.

TERMBUF_WIDTHS=off                      # skip the probe, keep the tables
TERMBUF_WIDTHS=+ambiguous_wide          # a CJK terminal, said not measured
TERMBUF_WIDTHS=-joined_emoji,-emoji_presentation

A bare name turns a rule on, a leading - turns it off, and anything not mentioned keeps whatever was measured. off skips the measurement.

Names are the WidthPolicy rules. An unknown one is reported rather than raised on, for the same reason TERMBUF_CAPS does it: a typo in an environment variable should not stop an application from starting, and the complaint must not reach the screen the application is about to take over.

Extended Modules

Defined in:

termbuf/unicode/overrides.cr

Constant Summary

VARIABLE = "TERMBUF_WIDTHS"

The variable itself, deliberately not application specific.

Instance Method Summary

Instance Method Detail

def apply(base : WidthPolicy, env : Hash(String, String) = ENV.to_h) : Result #

Applies VARIABLE from env to base.


[View source]
def apply(base : WidthPolicy, spec : String | Nil) : Result #

Applies a +name,-name list to base. A nil or empty spec changes nothing.


[View source]
def probe?(env : Hash(String, String)) : Bool #

Whether env asks for the measurement to be skipped.


[View source]
def probe?(spec : String | Nil) : Bool #

Whether env asks for the measurement to be skipped.


[View source]