miller/test/cases/io-multi-character-ixs
John Kerl a723f6cdaa
Fix PPRINT alignment with multi-character OFS (#1819) (#2063)
* Fix column alignment for wide and combining Unicode chars (#1520, #379)

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>

* Fix PPRINT alignment with multi-character OFS (#1819)

Previously, writePadding repeated the OFS string for each padding slot, so
non-space or multi-character OFS values produced misaligned columns and
leaked the separator into padding (e.g. --ofs=XY yielded aXYXYXYXYb).

Pad with spaces instead, leaving OFS to act only as the column separator.
The default single-space OFS is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Use non-space multi-char OFS in test 0021 for Windows portability

PowerShell collapses single-quoted '  ' in command lines, which broke
the test on the windows-latest CI runner. Switch to --ofs XY, which
exercises the same multi-character padding code path without shell
quoting hazards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 12:45:49 -04:00
..
0001 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0002 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0003 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0004 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0005 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0006 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0007 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0008 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0009 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0010 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0011 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0012 Make --ifs-regex and --ips-regex explicit command-line flags (#799) 2021-12-25 00:00:18 -05:00
0013 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0014 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0015 Fix PPRINT alignment with multi-character OFS (#1819) (#2063) 2026-05-17 12:45:49 -04:00
0016 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0017 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0018 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0019 Use fixed OFMT for multi-platform regression-testing (#988) 2022-03-16 14:44:42 -04:00
0020 Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
0021 Fix PPRINT alignment with multi-character OFS (#1819) (#2063) 2026-05-17 12:45:49 -04:00