From 4943e4a2f8b09c5e5c01fc3ff009f92f99f8b36f Mon Sep 17 00:00:00 2001 From: Philippe Potvin Date: Thu, 15 Dec 2016 11:08:36 -0500 Subject: [PATCH] Fix key focus (#1218) --- lib/hterm.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/hterm.js b/lib/hterm.js index 079a986d..d3750ee4 100644 --- a/lib/hterm.js +++ b/lib/hterm.js @@ -213,20 +213,22 @@ hterm.Keyboard.prototype.onKeyDown_ = function (e) { if (e.altKey || e.metaKey || isAccelerator(e)) { // hterm shouldn't consume a hyper accelerator + // // Was the hyperCaret removed for selectAll + if (e.key === 'v' && !this.terminal.cursorNode_.contains(this.hyperCaret)) { + this.terminal.focusHyperCaret(); + } return; } + // Test for valid keys in order to accept clear status + if (e.code !== 'Control' && e.key !== 'Shift' && e.code !== 'CapsLock' && e.key !== 'Dead') { + selection.clear(this.terminal); + } + // Was the hyperCaret removed for selectAll if (!this.terminal.cursorNode_.contains(this.hyperCaret)) { this.terminal.focusHyperCaret(); } - - if ((!e.ctrlKey || e.code !== 'ControlLeft') && - !e.shiftKey && e.code !== 'CapsLock' && - e.key !== 'Dead') { - // Test for valid keys in order to clear the terminal selection - selection.clear(this.terminal); - } return oldKeyDown.call(this, e); };