Skip to content

Commit fe30cd6

Browse files
authored
Merge pull request #4290 from JasonXJ/alt-space
Send corresponding escape code for alt+space and ctrl+alt+space
2 parents 497df06 + 7f64fa9 commit fe30cd6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/common/input/Keyboard.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ describe('Keyboard', () => {
125125
it('should return \\x1ba for alt+a', () => {
126126
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: false }).key, '\x1ba');
127127
});
128+
it('should return \\x1b\\x20 for alt+space', () => {
129+
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 32 }, { isMac: false }).key, '\x1b\x20');
130+
});
131+
it('should return \\x1b\\x00 for ctrl+alt+space', () => {
132+
assert.equal(testEvaluateKeyboardEvent({ altKey: true, ctrlKey: true, keyCode: 32 }, { isMac: false }).key, '\x1b\x00');
133+
});
128134
});
129135

130136
describe('On macOS platforms', () => {

src/common/input/Keyboard.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ export function evaluateKeyboardEvent(
360360
keyString = keyString.toUpperCase();
361361
}
362362
result.key = C0.ESC + keyString;
363+
} else if (ev.keyCode === 32) {
364+
result.key = C0.ESC + (ev.ctrlKey ? C0.NUL : ' ');
363365
} else if (ev.key === 'Dead' && ev.code.startsWith('Key')) {
364366
// Reference: https://github.com/xtermjs/xterm.js/issues/3725
365367
// Alt will produce a "dead key" (initate composition) with some

0 commit comments

Comments
 (0)