mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Merge pull request #2718 from kumaran-14/2498_alt_enter
Support alt+enter key signal by default
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user