Fix shift+return in vscode. (#12799)

This commit is contained in:
Tommaso Sciortino
2025-11-09 14:08:29 -08:00
committed by GitHub
parent 9e4ae214a8
commit fd59d9dd92
2 changed files with 17 additions and 2 deletions

View File

@@ -105,6 +105,21 @@ describe('KeypressContext', () => {
);
});
it('should handle backslash return', async () => {
const { keyHandler } = setupKeypressTest();
act(() => stdin.write('\\\r'));
expect(keyHandler).toHaveBeenCalledWith(
expect.objectContaining({
name: 'return',
ctrl: false,
meta: false,
shift: true,
}),
);
});
it.each([
{
modifier: 'Shift',

View File

@@ -68,7 +68,7 @@ function bufferBackslashEnter(
if (key == null) {
continue;
} else if (key.name !== '\\') {
} else if (key.sequence !== '\\') {
keypressHandler(key);
continue;
}
@@ -84,7 +84,7 @@ function bufferBackslashEnter(
keypressHandler(key);
} else if (nextKey.name === 'return') {
keypressHandler({
...key,
...nextKey,
shift: true,
sequence: '\r', // Corrected escaping for newline
});