mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Initial support for pressing ~ ^ " ' ` on international keyboard layouts until composed characters lands (#521)
* International keyboard support fixes * Use correct tilde character * Add correct caret char * Add alternate key code mapping for ~ and ` - credit: fecabianchi
This commit is contained in:
parent
c9fe3d82db
commit
519210ece6
1 changed files with 25 additions and 0 deletions
25
lib/hterm.js
25
lib/hterm.js
|
|
@ -29,6 +29,31 @@ hterm.Terminal.prototype.copySelectionToClipboard = function () {
|
|||
// hyperterm and not the terminal itself
|
||||
const oldKeyDown = hterm.Keyboard.prototype.onKeyDown_;
|
||||
hterm.Keyboard.prototype.onKeyDown_ = function (e) {
|
||||
/**
|
||||
* Add fixes for U.S. International PC Keyboard layout
|
||||
* These keys are sent through as 'Dead' keys, as they're used as modifiers.
|
||||
* Ignore that and insert the correct character.
|
||||
*/
|
||||
if (e.key === 'Dead' && e.code === 'Quote' && e.shiftKey === false) {
|
||||
this.terminal.onVTKeystroke("'");
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Dead' && e.code === 'Quote' && e.shiftKey === true) {
|
||||
this.terminal.onVTKeystroke('"');
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Dead' && (e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === true) {
|
||||
this.terminal.onVTKeystroke('~');
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Dead' && (e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === false) {
|
||||
this.terminal.onVTKeystroke('`');
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Dead' && e.code === 'Digit6') {
|
||||
this.terminal.onVTKeystroke('^');
|
||||
return;
|
||||
}
|
||||
if (e.metaKey || e.altKey) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue