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
11 changes: 10 additions & 1 deletion src/browser/input/CompositionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export class CompositionHelper {
*/
private _dataAlreadySent: string;

/**
* The pending textarea change timer, if any.
*/
private _textareaChangeTimer?: number;

constructor(
private readonly _textarea: HTMLTextAreaElement,
private readonly _compositionView: HTMLElement,
Expand Down Expand Up @@ -184,8 +189,12 @@ export class CompositionHelper {
* IME is active.
*/
private _handleAnyTextareaChanges(): void {
if (this._textareaChangeTimer) {
return;
}
const oldValue = this._textarea.value;
setTimeout(() => {
this._textareaChangeTimer = window.setTimeout(() => {
this._textareaChangeTimer = undefined;
// Ignore if a composition has started since the timeout
if (!this._isComposing) {
const newValue = this._textarea.value;
Expand Down