Add support to zero-width characters #29
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
windows
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
kahliburke/Tachikoma.jl!29
Loading…
Reference in a new issue
No description provided.
Delete branch "zero_width_chars"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
This PR fixes Unicode grapheme handling so zero-width combining marks render correctly in buffers and in
TerminalWidget(includingterminal_demo()), and it hardens wide-character overwrite behavior.Closes #28
Problem
n\u0307could appear asn.TerminalWidgetcould leave stale wide-cell state.char, not full glyph content.Changes
Cellto storesuffix::Stringfor trailing combining content.cell_glyph(c)to reconstruct full glyph (char + suffix)cell_width(c)to compute width from full glyphset_string!now iterates graphemes (Base.Unicode.graphemes)_split_glyph,_set_glyph!,_append_glyph!set_style!preservessuffixbuffer_to_textemits full glyphstext_masktreats non-empty suffix as visible textTerminalWidgetVT screen write logic:_screen_append_zero_width!attaches combining chars to previous display cell_screen_putchar!now handles zero-width chars instead of dropping them_screen_putchar!now cleans lead/pad neighbors when overwriting wide charsTests
Added regression coverage in:
test/test_core.jlBuffer zero-width graphemestest/test_terminal_widget.jlVT parser: zero-width combining marksVT parser: precomposed glyphVT parser: overwrite wide-char pad clears leadVT parser: overwrite wide-char lead clears padHi @kahliburke !
With this PR we now support zero-width characters in Tachikoma!
It also address the same problem in the TerminalWidget. Now we can have:
In previous version it shows everything as
n.I tests the performance using
fps_testand I found not noticeable regression.