Merge pull request #2718 from kumaran-14/2498_alt_enter

Support alt+enter key signal by default
This commit is contained in:
Daniel Imms
2020-04-11 05:49:33 -07:00
committed by GitHub
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -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', () => {
+4 -1
View File
@@ -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: