From a45fb9728361e254093412e4a996d3d4806fde00 Mon Sep 17 00:00:00 2001 From: Philippe Potvin Date: Thu, 8 Dec 2016 18:09:02 -0500 Subject: [PATCH] cmd+A work again (#1102) --- lib/hterm.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/hterm.js b/lib/hterm.js index 68440c4d..f2779986 100644 --- a/lib/hterm.js +++ b/lib/hterm.js @@ -15,9 +15,13 @@ const containers = []; // Provide selectAll to terminal viewport hterm.Terminal.prototype.selectAll = function () { - // We need to clear the DOM range to reset anchorNode - selection.clear(this); - selection.all(this); + // If the cursorNode_ having hyperCaret we need to remove it + if (this.cursorNode_.contains(this.hyperCaret)) { + this.cursorNode_.removeChild(this.hyperCaret); + // We need to clear the DOM range to reset anchorNode + selection.clear(this); + selection.all(this); + } }; const oldSetFontSize = hterm.Terminal.prototype.setFontSize; @@ -218,6 +222,10 @@ hterm.Terminal.prototype.copySelectionToClipboard = function () { // hyper and not the terminal itself const oldKeyDown = hterm.Keyboard.prototype.onKeyDown_; hterm.Keyboard.prototype.onKeyDown_ = function (e) { + // Was the hyperCaret removed for selectAll + if (!this.terminal.cursorNode_.contains(this.hyperCaret)) { + this.terminal.focusHyperCaret(); + } const modifierKeysConf = this.terminal.modifierKeys; if (e.altKey &&