fix: Korean/CJK IME input and rendering in Sidebar Terminal#1297
fix: Korean/CJK IME input and rendering in Sidebar Terminal#1297realcarsonterry wants to merge 1 commit intogarrytan:mainfrom
Conversation
Fixes garrytan#1272 This commit addresses three separate Korean/CJK bugs in the Sidebar Terminal: **Bug 1 - IME Input**: Korean text typed via IME composition was not reaching the PTY correctly. Added compositionstart/compositionend event listeners to suppress partial jamo fragments and only send the final composed string. **Bug 2a - Font Rendering**: Added CJK monospace font fallbacks ("Noto Sans Mono CJK KR", "Malgun Gothic") to both the xterm.js fontFamily config and the CSS --font-mono variable. This ensures consistent cell-width calculations for Korean characters. **Bug 2b - UTF-8 Boundary Detection**: Added buffering logic to prevent multi-byte UTF-8 characters (Korean is 3 bytes) from being split across WebSocket chunks. This follows the same pattern as PR garrytan#1007 which fixed the sidebar-agent path, but extends it to the terminal-agent path. Special thanks to @ldybob for the excellent root cause analysis and proposed solutions in issue garrytan#1272. Tested on WSL2 + Windows 11 with Korean IME.
908ce92 to
4bd6359
Compare
|
Hey! I've been using gstack on WSL2 and ran into this issue where Korean input was completely broken in the sidebar terminal. Spent some time debugging and found it was actually three separate bugs working together. The UTF-8 splitting issue was interesting - looks like PR #1007 fixed it for sidebar-agent but terminal-agent was still affected. Applied the same buffering pattern here. Let me know if you'd like me to add any additional test cases or documentation. Thanks for building this tool btw, it's been super helpful for my workflow! |
|
Heads up - it looks like the CI workflows aren't running because I'm a first-time contributor to this repo. GitHub's security policy blocks automatic workflow runs for external contributors. Would a maintainer be able to approve the workflow run so the tests can execute? The changes are pretty straightforward (IME handling + font fallbacks + UTF-8 buffering), but I'd love to see the CI results to make sure everything passes. Thanks! |
Summary
Fixes #1272 - Korean/CJK IME input and rendering issues in Sidebar Terminal
Special thanks to @ldybob for the excellent root cause analysis and proposed solutions.
Problem
The Sidebar Terminal had three separate Korean/CJK bugs:
Changes
Bug 1: IME Composition Handling
compositionstart/compositionendevent listeners inextension/sidepanel-terminal.jscompositionendBug 2a: CJK Font Fallback
fontFamilyinextension/sidepanel-terminal.jsto include"Noto Sans Mono CJK KR"and"Malgun Gothic"--font-monoCSS variable inextension/sidepanel.csswith the same fontsBug 2b: UTF-8 Boundary Detection
browse/src/terminal-agent.tsto prevent splitting multi-byte UTF-8 characterssidebar-agentpathterminal-agentpath (which was missed in fix: preserve multi-byte UTF-8 across sidebar-agent stdout chunks #1007)Testing
✅ Korean input via IME now works correctly
✅ Korean output renders without garbled characters
✅ English input/output still works as expected
✅ Cursor positioning is correct for mixed English/Korean text
Impact
This fix enables Korean and other CJK developers using gstack on WSL2/Windows to fully use the Sidebar Terminal in their native language. Both input and output now work correctly.