Fix key focus (#1218)

This commit is contained in:
Philippe Potvin 2016-12-15 11:08:36 -05:00 committed by GitHub
parent 63ab44778b
commit 4943e4a2f8

View file

@ -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);
};