Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion extension/sidepanel-terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,15 @@
if (ta) {
ta.addEventListener('compositionstart', () => { composing = true; });
ta.addEventListener('compositionend', (e) => {
composing = false;
if (e.data && ws && ws.readyState === WebSocket.OPEN) {
ws.send(new TextEncoder().encode(e.data));
}
// Reset on the next tick. Browsers fire the trailing `input` event
// (→ term.onData) immediately AFTER compositionend, for the same
// composed string. Clearing `composing` synchronously lets that
// event through, double-sending CJK input (e.g. "在在这里这里").
// Deferring keeps onData suppressed for that trailing event.
setTimeout(() => { composing = false; }, 0);
});
}

Expand Down