mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-16 21:58:39 -09:00
🐛 Fix copy/paste shortcuts on Windows/Linux 🎉 (#1406)
This commit is contained in:
parent
d54fa3889b
commit
b4943a05e9
1 changed files with 13 additions and 6 deletions
19
lib/hterm.js
19
lib/hterm.js
|
|
@ -223,22 +223,29 @@ hterm.Keyboard.prototype.onKeyDown_ = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hterm shouldn't consume a hyper accelerator
|
||||||
if (e.altKey || e.metaKey || isAccelerator(e)) {
|
if (e.altKey || e.metaKey || isAccelerator(e)) {
|
||||||
// hterm shouldn't consume a hyper accelerator
|
// If the `hyperCaret` was removed on `selectAll`, we need to insert it back
|
||||||
// // Was the hyperCaret removed for selectAll
|
if (e.key === 'v' && this.terminal.hyperCaret.parentNode !== this.terminal.cursorNode_) {
|
||||||
if (e.key === 'v' && !this.terminal.cursorNode_.contains(this.hyperCaret)) {
|
|
||||||
this.terminal.focusHyperCaret();
|
this.terminal.focusHyperCaret();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test for valid keys in order to accept clear status
|
// 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);
|
selection.clear(this.terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Was the hyperCaret removed for selectAll
|
// If the `hyperCaret` was removed on `selectAll`, we need to insert it back
|
||||||
if (!this.terminal.cursorNode_.contains(this.hyperCaret)) {
|
if (this.terminal.hyperCaret.parentNode !== this.terminal.cursorNode_) {
|
||||||
this.terminal.focusHyperCaret();
|
this.terminal.focusHyperCaret();
|
||||||
}
|
}
|
||||||
return oldKeyDown.call(this, e);
|
return oldKeyDown.call(this, e);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue