diff --git a/src/common/input/Keyboard.test.ts b/src/common/input/Keyboard.test.ts index a304923e8f..0bb0e24c15 100644 --- a/src/common/input/Keyboard.test.ts +++ b/src/common/input/Keyboard.test.ts @@ -86,6 +86,12 @@ describe('Keyboard', () => { it('should return \\x1b[3;3~ for alt+delete', () => { assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 46 }).key, '\x1b[3;3~'); }); + it('should return \\x1b\\r for alt+enter', () => { + assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }).key, '\x1b\r'); + }); + it('should return \\x1b\\x1b for alt+esc', () => { + assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 27 }).key, '\x1b\x1b'); + }); it('should return \\x1b[5D for ctrl+left', () => { assert.equal(testEvaluateKeyboardEvent({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D }); @@ -141,6 +147,10 @@ describe('Keyboard', () => { it('should return \\x1ba for alt+a', () => { assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: true, macOptionIsMeta: true }).key, '\x1ba'); }); + + it('should return \\x1b\\x1b for alt+enter', () => { + assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }, { isMac: true, macOptionIsMeta: true }).key, '\x1b\r'); + }); }); it('should return \\x1b[5A for alt+up', () => { diff --git a/src/common/input/Keyboard.ts b/src/common/input/Keyboard.ts index 1bf378c171..fdb777b428 100644 --- a/src/common/input/Keyboard.ts +++ b/src/common/input/Keyboard.ts @@ -103,12 +103,15 @@ export function evaluateKeyboardEvent( break; case 13: // return/enter - result.key = C0.CR; + result.key = ev.altKey ? C0.ESC + C0.CR : C0.CR; result.cancel = true; break; case 27: // escape result.key = C0.ESC; + if (ev.altKey) { + result.key = C0.ESC + C0.ESC; + } result.cancel = true; break; case 37: