From a348185cc57b00719edf0cdb07878a6ccf9a0232 Mon Sep 17 00:00:00 2001 From: CHaBou Date: Sun, 3 Sep 2017 18:06:12 +0200 Subject: [PATCH] Fixed writing composed characters (#2158) Fixes #2140 --- lib/hterm.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hterm.js b/lib/hterm.js index e7feb4d2..6845276b 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