mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Fix international tilde character, and ` and ´ (#584)
* This fixes many more keyboard layouts * Make backticks work on German keyboards * Add italian keyboard layout, and also log when uncaught dead key occurs
This commit is contained in:
parent
f24c1a5499
commit
cb651f6492
1 changed files with 48 additions and 19 deletions
67
lib/hterm.js
67
lib/hterm.js
|
|
@ -34,26 +34,55 @@ hterm.Keyboard.prototype.onKeyDown_ = function (e) {
|
||||||
* These keys are sent through as 'Dead' keys, as they're used as modifiers.
|
* These keys are sent through as 'Dead' keys, as they're used as modifiers.
|
||||||
* Ignore that and insert the correct character.
|
* Ignore that and insert the correct character.
|
||||||
*/
|
*/
|
||||||
if (e.key === 'Dead' && e.code === 'Quote' && e.shiftKey === false) {
|
if (e.key === 'Dead') {
|
||||||
this.terminal.onVTKeystroke("'");
|
if (e.code === 'Quote' && e.shiftKey === false) {
|
||||||
return;
|
this.terminal.onVTKeystroke("'");
|
||||||
}
|
return;
|
||||||
if (e.key === 'Dead' && e.code === 'Quote' && e.shiftKey === true) {
|
}
|
||||||
this.terminal.onVTKeystroke('"');
|
if (e.code === 'Quote' && e.shiftKey === true) {
|
||||||
return;
|
this.terminal.onVTKeystroke('"');
|
||||||
}
|
return;
|
||||||
if (e.key === 'Dead' && (e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === true) {
|
}
|
||||||
this.terminal.onVTKeystroke('~');
|
if ((e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === true) {
|
||||||
return;
|
this.terminal.onVTKeystroke('~');
|
||||||
}
|
return;
|
||||||
if (e.key === 'Dead' && (e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === false) {
|
}
|
||||||
this.terminal.onVTKeystroke('`');
|
// This key is also a tilde on all tested keyboards
|
||||||
return;
|
if (e.code === 'KeyN' && e.altKey === true) {
|
||||||
}
|
this.terminal.onVTKeystroke('~');
|
||||||
if (e.key === 'Dead' && e.code === 'Digit6') {
|
return;
|
||||||
this.terminal.onVTKeystroke('^');
|
}
|
||||||
return;
|
if ((e.code === 'IntlBackslash' || e.code === 'Backquote') && e.shiftKey === false) {
|
||||||
|
this.terminal.onVTKeystroke('`');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.code === 'Digit6') {
|
||||||
|
this.terminal.onVTKeystroke('^');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// German keyboard layout
|
||||||
|
if (e.code === 'Equal' && e.shiftKey === false) {
|
||||||
|
this.terminal.onVTKeystroke('´');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.code === 'Equal' && e.shiftKey === true) {
|
||||||
|
this.terminal.onVTKeystroke('`');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Italian keyboard layout
|
||||||
|
if (e.code === 'Digit9' && e.altKey === true) {
|
||||||
|
this.terminal.onVTKeystroke('`');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.code === 'Digit8' && e.altKey === true) {
|
||||||
|
this.terminal.onVTKeystroke('´');
|
||||||
|
// To fix issue with changing the terminal prompt
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.warn('Uncaught dead key on international keyboard', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.metaKey || e.altKey) {
|
if (e.metaKey || e.altKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue