Documentation
¶
Overview ¶
Package glyphs — filter.go: byte-level emoji → ASCII rewriter.
Implemented as a precomputed bytes.Replacer-equivalent: a flat list of (needle, replacement) pairs scanned in a single left-to-right pass. Keeps allocations to one buffer per Write call.
Package glyphs resolves the active glyph-rendering mode (rich vs safe) and installs an os.Stdout / os.Stderr byte-stream filter that rewrites emoji into ASCII fallbacks when "safe" is active.
Composition: chains AFTER gitmap/theme.Install — both packages wrap the standard handles with a pipe; stacking is fine and order- independent since each filter only touches its own byte patterns.
Package glyphs — install.go: optional pipe-wrap that runs every stdout / stderr byte through Filter. Skipped entirely in ModeRich for true zero-overhead passthrough.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Drain ¶
func Drain()
Drain closes every installed pipe writer and waits for the matching forwarder goroutine to flush its buffered bytes to the underlying destination fd. MUST be called before os.Exit when output integrity matters (e.g. cliexit.Fail) — otherwise the last failure message can vanish on Windows.
After Drain returns the wrapped os.Stdout / os.Stderr are closed and any further writes will fail with ErrClosed. That is the correct shape for an exit-path-only flusher.
func Filter ¶
Filter returns p with every glyph rewritten per table when mode is ModeSafe. ModeRich returns p unchanged (zero-cost passthrough).
func Install ¶
func Install()
Install resolves the active mode and (when ModeSafe) replaces os.Stdout / os.Stderr with pipe-backed writers that filter glyphs. Idempotent across calls.
func IsValidLabel ¶
IsValidLabel reports whether label is a recognized glyph mode.