fix(patch): cherry-pick e1fd5be to release/v0.25.0-preview.4-pr-17131 [CONFLICTS]#17165
Conversation
# Conflicts: # docs/cli/keyboard-shortcuts.md # packages/cli/src/ui/components/InputPrompt.test.tsx # packages/cli/src/ui/components/InputPrompt.tsx # packages/cli/src/ui/components/StatusDisplay.tsx # packages/cli/src/ui/components/__snapshots__/StatusDisplay.test.tsx.snap
Summary of ChangesHello @gemini-cli-robot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request, an automated cherry-pick, introduces a significant enhancement to the CLI's user experience by refining the behavior of the double Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is an automatic cherry-pick that has resulted in multiple merge conflicts across several files. The presence of <<<<<<< HEAD, =======, and >>>>>>> markers indicates that the merge was not completed successfully and the files are in an inconsistent state. These conflicts must be resolved before the pull request can be merged. The changes related to the Esc-Esc functionality and TextBuffer type updates appear correct once the conflicts are addressed.
| <<<<<<< HEAD | ||
| - `Esc` pressed twice quickly: Clear the current input buffer. | ||
| ======= | ||
| - `Esc` pressed twice quickly: Clear the input prompt if it is not empty, | ||
| otherwise browse and rewind previous interactions. | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| it('should clear buffer on double ESC', async () => { | ||
| const onEscapePromptChange = vi.fn(); | ||
| props.onEscapePromptChange = onEscapePromptChange; | ||
| props.buffer.setText('text to clear'); | ||
| ======= | ||
| it('should submit /rewind on double ESC when buffer is empty', async () => { | ||
| const onEscapePromptChange = vi.fn(); | ||
| props.onEscapePromptChange = onEscapePromptChange; | ||
| props.buffer.setText(''); | ||
| vi.mocked(props.buffer.setText).mockClear(); | ||
|
|
||
| const { stdin, unmount } = renderWithProviders( | ||
| <InputPrompt {...props} />, | ||
| { | ||
| uiState: { | ||
| history: [{ id: 1, type: 'user', text: 'test' }], | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| await act(async () => { | ||
| stdin.write('\x1B\x1B'); | ||
| vi.advanceTimersByTime(100); | ||
|
|
||
| expect(props.onSubmit).toHaveBeenCalledWith('/rewind'); | ||
| }); | ||
| unmount(); | ||
| }); | ||
|
|
||
| it('should clear the buffer on esc esc if it has text', async () => { | ||
| const onEscapePromptChange = vi.fn(); | ||
| props.onEscapePromptChange = onEscapePromptChange; | ||
| props.buffer.setText('some text'); | ||
| vi.mocked(props.buffer.setText).mockClear(); | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| expect(mockCommandCompletion.resetCompletionState).toHaveBeenCalled(); | ||
| ======= | ||
| expect(props.onSubmit).not.toHaveBeenCalledWith('/rewind'); | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| // Handle double ESC for clearing input | ||
| ======= | ||
| // Handle double ESC | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| // clear input and immediately reset state | ||
| buffer.setText(''); | ||
| resetCompletionState(); | ||
| resetEscapeState(); | ||
| ======= | ||
| // Second ESC | ||
| resetEscapeState(); | ||
| if (buffer.text.length > 0) { | ||
| buffer.setText(''); | ||
| resetCompletionState(); | ||
| } else { | ||
| if (history.length > 0) { | ||
| onSubmit('/rewind'); | ||
| } | ||
| } | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| return <Text color={theme.text.secondary}>Press Esc again to clear.</Text>; | ||
| ======= | ||
| const isPromptEmpty = uiState.buffer.text.length === 0; | ||
| const hasHistory = uiState.history.length > 0; | ||
|
|
||
| if (isPromptEmpty && !hasHistory) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Text color={theme.text.secondary}> | ||
| Press Esc again to {isPromptEmpty ? 'rewind' : 'clear prompt'}. | ||
| </Text> | ||
| ); | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
| <<<<<<< HEAD | ||
| exports[`StatusDisplay > renders Escape prompt 1`] = `"Press Esc again to clear."`; | ||
| ======= | ||
| exports[`StatusDisplay > renders Escape prompt when buffer is NOT empty 1`] = `"Press Esc again to clear prompt."`; | ||
|
|
||
| exports[`StatusDisplay > renders Escape prompt when buffer is empty 1`] = `"Press Esc again to rewind."`; | ||
| >>>>>>> e1fd5be42 (Add Esc-Esc to clear prompt when it's not empty (#17131)) |
|
Size Change: +377 B (0%) Total Size: 23 MB ℹ️ View Unchanged
|
This PR automatically cherry-picks commit e1fd5be to patch version v0.25.0-preview.4 in the preview release to create version 0.25.0-preview.5.
This cherry-pick resulted in merge conflicts that need manual resolution.
🔧 Next Steps:
📋 Files with conflicts:
The commit has been created with conflict markers for easier manual resolution.
🚨 Important: