diff --git a/lib/hterm.js b/lib/hterm.js index 27ad71bf..7c9ab102 100644 --- a/lib/hterm.js +++ b/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; }