fix: prevent Shift+Tab from accepting prompt placeholder suggestion (#3051)

Add !key.shift guard to the Tab key handler for prompt suggestion
acceptance, so Shift+Tab only toggles approval mode without inserting
the placeholder text into the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
克竟 2026-04-09 20:18:09 +08:00
parent 4d2d4432d5
commit 5947512a79
2 changed files with 14 additions and 0 deletions

View file

@ -225,6 +225,19 @@ describe('InputPrompt', () => {
unmount();
});
it('does not accept the prompt suggestion on shift+tab', async () => {
const { stdin, unmount } = renderWithProviders(
<InputPrompt {...props} promptSuggestion="commit this" />,
);
await wait(350);
stdin.write('\x1b[Z'); // shift+tab
await wait();
expect(mockBuffer.insert).not.toHaveBeenCalled();
unmount();
});
it('accepts and submits the prompt suggestion on Enter when the buffer is empty', async () => {
const { stdin, unmount } = renderWithProviders(
<InputPrompt {...props} promptSuggestion="commit this" />,