-
Fix crash with Korean/CJK/emoji input in TUI
发布于
2026-02-28 07:12:30 +00:00 The input handling used byte offsets (+1/-1) for cursor movement, which
panics on multi-byte UTF-8 characters like Korean (3 bytes), Chinese
(3 bytes), or emoji (4 bytes).Changes:
- Add prev_char_boundary/next_char_boundary helpers in tui::core
- Fix insert_char to advance cursor by c.len_utf8() instead of 1
- Fix backspace/delete to operate on full character boundaries
- Fix cursor_left/right to navigate by character boundaries
- Fix Ctrl+B/F (emacs nav) for multi-byte characters
- Fix find_word_boundary_back/forward to use char iteration
- Fix wrap_input_text to wrap by display width (CJK = 2 columns)
- Fix cursor_col to return display columns, not char count
- Fix calculate_input_lines to use unicode display widths
- Apply same fixes across App, TuiCore, and ClientApp
- Add tests for Korean, Chinese, emoji, and mixed input
下载附件