Skip to content

fix(tui): align input cursor with wide characters - #21

Open
bonzonkim wants to merge 1 commit into
folke:mainfrom
bonzonkim:fix/wide-glyph
Open

fix(tui): align input cursor with wide characters#21
bonzonkim wants to merge 1 commit into
folke:mainfrom
bonzonkim:fix/wide-glyph

Conversation

@bonzonkim

@bonzonkim bonzonkim commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Fix TUI input cursor/rendering behavior for wide glyphs such as Korean and CJK characters.

  • Compute input cursor columns using terminal cell width instead of JavaScript string length
  • Map visual columns back to string offsets for vertical cursor movement
  • Add regressions for wide-character cursor placement and Korean input rendering

Verification

  • bun x vitest run packages/tui/test/nodes/input.test.ts packages/tui/test/terminal/resize.test.ts
  • git diff --check
  • bun z build
  • ./packages/cli/dist/zaly.mjs --help

Notes

This fixes the cursor offset issue for committed wide characters. The remaining “one syllable delayed” behavior appears to depend on terminal IME preedit/commit
timing: standard TTY input only receives text after the terminal commits it, so the app cannot render preedit text that has not been delivered yet.


Before

Screen.Recording.2026-07-11.at.15.28.43.mov

After

Screen.Recording.2026-07-11.at.15.28.58.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant