mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -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();
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue