Skip to content

Commit 409f049

Browse files
authored
Update src/browser/CoreBrowserTerminal.ts
1 parent 9e1b896 commit 409f049

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/browser/CoreBrowserTerminal.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,11 @@ export class CoreBrowserTerminal extends CoreTerminal implements ITerminal {
415415
this._register(addDisposableListener(this.textarea!, 'keydown', (ev: KeyboardEvent) => this._keyDown(ev), true));
416416
this._register(addDisposableListener(this.textarea!, 'keypress', (ev: KeyboardEvent) => this._keyPress(ev), true));
417417
this._register(addDisposableListener(this.textarea!, 'compositionstart', () => {
418-
// Ensure the textarea is synced to the latest cursor location before composition begins.
419-
// Some prompt UIs briefly draw helper text and then restore the cursor without triggering a
420-
// new key event, which can leave IME anchoring stale until the first render tick.
418+
// Ensure the textarea is synced to the latest cursor location before composition begins. This
419+
// is to workaround a problem where highly dynamic TUIs like agentic CLIs reprint agressively
420+
// would cause the IME to appear in the wrong position. The theory is that when the IME is
421+
// triggered during a partial render the textarea position becomes locked and will not move
422+
// until it is hidden and a custom move occurs.
421423
this._syncTextArea();
422424
this._compositionHelper!.compositionstart();
423425
this._compositionHelper!.updateCompositionElements();

0 commit comments

Comments
 (0)