🐛 Fix copy/paste shortcuts on Windows/Linux 🎉 (#1406)

This commit is contained in:
Matheus Fernandes 2017-01-18 13:19:11 -02:00 committed by GitHub
parent d54fa3889b
commit b4943a05e9

View file

@ -223,22 +223,29 @@ hterm.Keyboard.prototype.onKeyDown_ = function (e) {
e.preventDefault();
}
// hterm shouldn't consume a hyper accelerator
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)) {
// If the `hyperCaret` was removed on `selectAll`, we need to insert it back
if (e.key === 'v' && this.terminal.hyperCaret.parentNode !== this.terminal.cursorNode_) {
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') {
const clearBlacklist = [
'control',
'shift',
'capslock',
'dead'
];
if (!clearBlacklist.includes(e.code.toLowerCase()) &&
!clearBlacklist.includes(e.key.toLowerCase())) {
selection.clear(this.terminal);
}
// Was the hyperCaret removed for selectAll
if (!this.terminal.cursorNode_.contains(this.hyperCaret)) {
// If the `hyperCaret` was removed on `selectAll`, we need to insert it back
if (this.terminal.hyperCaret.parentNode !== this.terminal.cursorNode_) {
this.terminal.focusHyperCaret();
}
return oldKeyDown.call(this, e);