miller/pkg/lib
John Kerl 16209eecf8
Fix column alignment for wide and combining Unicode chars (#1520, #379) (#2061)
PPRINT, markdown-aligned, and XTAB writers measured column widths with
utf8.RuneCountInString, which counts codepoints rather than terminal
display columns. East-Asian fullwidth characters (counted as 1 but
displayed as 2) and zero-width combining marks (counted as 1 but
displayed as 0) both caused misalignment.

Add lib.DisplayWidth wrapping uniseg.StringWidth, and use it from the
three writers. The XTAB right-aligned path also drops fmt.Sprintf with
%*s since Go's %*s pads by rune count too.

UTF8Strlen is unchanged so DSL strlen semantics are preserved.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 12:12:54 -04:00
..
doc.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
docurl.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
file_readers.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
getoptify.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
halfpipe.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
latin1.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
latin1_test.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
logger.go Improve error propagation (#1975) 2026-02-16 16:48:41 -05:00
mlrmath.go Performance and style fixes (#1981) 2026-02-18 09:19:31 -05:00
ordered_map.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
paragraph.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
rand.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
readfiles.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
README.md Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
regex.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
regex_test.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
stats.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
time.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
time_test.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
tsv_codec.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
tsv_codec_test.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
unbackslash.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
unbackslash_test.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
util.go Fix column alignment for wide and combining Unicode chars (#1520, #379) (#2061) 2026-05-17 12:12:54 -04:00

These are basic library routines for Miller.