Update src/browser/CoreBrowserTerminal.ts

This commit is contained in:
Daniel Imms
2026-03-11 12:02:02 +09:00
committed by GitHub
parent 9e1b89651a
commit 409f049f39
+5 -3
View File
@@ -415,9 +415,11 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));
this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));
this._register(addDisposableListener(this.textarea!, 'compositionstart', () => {
// Ensure the textarea is synced to the latest cursor location before composition begins.
// Some prompt UIs briefly draw helper text and then restore the cursor without triggering a
// new key event, which can leave IME anchoring stale until the first render tick.
// Ensure the textarea is synced to the latest cursor location before composition begins. This
// is to workaround a problem where highly dynamic TUIs like agentic CLIs reprint agressively
// would cause the IME to appear in the wrong position. The theory is that when the IME is
// triggered during a partial render the textarea position becomes locked and will not move
// until it is hidden and a custom move occurs.
this._syncTextArea();
this._compositionHelper!.compositionstart();
this._compositionHelper!.updateCompositionElements();