diff options
| author | TMY <93774927+TMYTiMidlY@users.noreply.github.com> | 2026-04-22 21:09:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-22 15:09:25 +0200 |
| commit | 902e0bbd662f8db3043a94e8e502a5490642edac (patch) | |
| tree | 00de04c0b9f82c4450c5805125930865c0f54c43 /example | |
| parent | fix: lost web characters (#5080) (diff) | |
| download | sl0ppij-902e0bbd662f8db3043a94e8e502a5490642edac.tar.gz sl0ppij-902e0bbd662f8db3043a94e8e502a5490642edac.tar.xz sl0ppij-902e0bbd662f8db3043a94e8e502a5490642edac.zip | |
fix(web-client): prevent IME input text repetition (#4975)
* fix(web-client): prevent IME input text repetition
Fix bug where composing multi-character strings via IME (e.g. Chinese input method) would write the entire string N times for N characters.
Previously, parse_stdin sent the entire input buffer as raw_bytes for each KeyEvent parsed from that buffer. When IME composes "你好" (2 chars), InputParser creates 2 KeyEvents, but both carried the full "你好" bytes, causing it to be written twice.
Now, when multiple events are parsed from one buffer, each Char KeyEvent carries only its own UTF-8 bytes. Single-event buffers (most ASCII input) remain unchanged.
Fixes #4974
* fix: guard per-char raw_bytes with modifiers check
Only use per-character UTF-8 encoding for unmodified Char events in multi-event buffers. Modified keys (e.g. Ctrl+C) retain the original buffer to preserve correct VT bytes. Also clarify the comment.
* test(web-client): cover IME raw byte handling
* rustfmt
---------
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'example')
0 files changed, 0 insertions, 0 deletions
