diff --git a/lib/hterm.js b/lib/hterm.js index e7feb4d2ad00..6845276b2326 100644 --- a/lib/hterm.js +++ b/lib/hterm.js @@ -256,7 +256,9 @@ hterm.Keyboard.prototype.onKeyDown_ = function (e) { ]; if (!clearBlacklist.includes(e.code.toLowerCase()) && !clearBlacklist.includes(e.key.toLowerCase())) { - selection.clear(this.terminal); + // Since Electron 1.6.X, there is a race condition with character composition + // if this selection clearing is made synchronously. See #2140. + setTimeout(() => selection.clear(this.terminal), 0); } // If the `hyperCaret` was removed on `selectAll`, we need to insert it back