Skip to content

Commit 5e9b2e3

Browse files
Merge pull request #428 from migueldeicaza/wcspec
For a while, we had a bit of a hodgepodge of attempts to measuring characters properly. And I discovered ucs-detect [1] along with a spec for how terminal emulators should measure unicode [2]. This patch implements that behavior. Unicode width now comes from UCD properties + EastAsianWidth W/F ranges and valid emoji‑variation sequences, and printing/combining now respects width ‑1/0 and only widens on valid VS16 (witha spacer cell) while dropping invalid zero‑widths. We had a discussion last week on GitHub about some of these problems, and my band-aid worked for a couple of things, but was by no means comphrenesive. [1] https://ucs-detect.readthedocs.io/intro.html [2] https://wcwidth.readthedocs.io/en/latest/specs.html The improvements are in: https://gist.github.com/migueldeicaza/a81dc7fd5a31f10cd24b2ba60b28a083 See the bug for before/after screenshots. This fixes #427
2 parents fa9e3cb + 771d48d commit 5e9b2e3

7 files changed

Lines changed: 527 additions & 631 deletions

File tree

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ TOOLCHAINS=org.swift.573202201171a
66
all:
77
echo nothing defined by default
88

9+
regen-unicode-width:
10+
python3 scripts/regen_unicode_width_data.py
11+
912
jazzy:
1013
(cd TerminalApp; DYLD_FALLBACK_LIBRARY_PATH=/Users/miguel/opt/anaconda3/lib/ jazzy --clean --author "Miguel de Icaza" --author_url https://tirania.org/ --github_url https://github.com/migueldeicaza/SwiftTerm --github-file-prefix https://github.com/migueldeicaza/SwiftTerm/tree/master --module-version 1.0 --module SwiftTerm --root-url https://migueldeicaza.github.io/SwiftTerm/ --output ../docs --build-tool-arguments -scheme,MacTerminal,-project,MacTerminal.xcodeproj)
1114

0 commit comments

Comments
 (0)