feat(terminal): Chinese / IME input (P3)
Implement IME composition support and migrate regular character input to a hidden textarea, matching the xterm.js approach. Key changes: - Add a hidden, absolutely-positioned `<textarea>` inside `.terminal-screen` that follows the terminal cursor cell. It receives focus on click, connect, and resize so the OS/browser IME candidate window appears at the cursor. - `on:input` now sends regular printable characters; `on:keydown` only handles special keys (arrows, Enter, Esc, Backspace, F-keys, Ctrl combos). - `on:compositionstart/end` track IME sessions and send the final composed string at the end, avoiding partial pinyin/jamo/kana leaks. - Move `on:paste` and `on:keydown` from `.terminal-screen` to the textarea so focus stays on the IME target. - Replace `.terminal-screen:focus` with `:focus-within` since the screen div no longer holds focus. - Add `is_regular_text_input` helper and unit test. Web-sys features extended with `InputEvent` and `CompositionEvent`. Tests: 24/24 pass, clippy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,7 @@ web-sys = { version = "0.3", default-features = false, features = [
|
||||
"Clipboard",
|
||||
"ClipboardEvent",
|
||||
"CloseEvent",
|
||||
"CompositionEvent",
|
||||
"console",
|
||||
"DataTransfer",
|
||||
"Document",
|
||||
@@ -52,6 +53,7 @@ web-sys = { version = "0.3", default-features = false, features = [
|
||||
"Event",
|
||||
"EventTarget",
|
||||
"HtmlElement",
|
||||
"InputEvent",
|
||||
"KeyboardEvent",
|
||||
"Location",
|
||||
"MessageEvent",
|
||||
|
||||
Reference in New Issue
Block a user