refactor: shared Unicode display-width utility with grapheme cluster support
Consolidate two inconsistent codepoint_width implementations from Screen.cpp and EventEditor.cpp into nocal/tui/unicode.hpp. The unified table covers all CJK, Hangul, emoji, symbol, and combining mark ranges. display_width and fit_text handle grapheme clusters (ZWJ sequences, skin-tone/hair modifiers, regional indicator pairs, variation selectors) so calendar text with emoji or East Asian characters renders correctly.
This commit is contained in:
@@ -39,6 +39,7 @@ nocal_sources = files(
|
||||
'src/tui/EventEditor.cpp',
|
||||
'src/tui/Terminal.cpp',
|
||||
'src/tui/TuiApp.cpp',
|
||||
'src/tui/unicode.cpp',
|
||||
)
|
||||
nocal_lib = static_library('nocal-core', nocal_sources, include_directories: inc,
|
||||
dependencies: [sqlite, libcrypto, libcurl, libsecret, nlohmann_json])
|
||||
@@ -105,10 +106,14 @@ test('tui', tui_tests)
|
||||
tui_focus_tests = executable('tui-focus-tests', 'tests/tui_focus_tests.cpp',
|
||||
dependencies: nocal_dep)
|
||||
test('tui-focus', tui_focus_tests)
|
||||
editor_tests = executable('editor-tests', 'tests/editor_tests.cpp',
|
||||
dependencies: nocal_dep)
|
||||
editor_tests = executable('editor-tests',
|
||||
'tests/editor_tests.cpp', dependencies: nocal_dep)
|
||||
test('editor', editor_tests)
|
||||
|
||||
unicode_tests = executable('unicode-tests',
|
||||
'tests/unicode_tests.cpp', dependencies: nocal_dep)
|
||||
test('nocal:unicode', unicode_tests)
|
||||
|
||||
test('cli-recovery', shell,
|
||||
args: [files('tests/cli_recovery_test.sh'), nocal_executable])
|
||||
test('cli-transfer', shell,
|
||||
|
||||
Reference in New Issue
Block a user