feat(cli): support home key in input prompt#2364
Conversation
Adds support for the "Home" key to move the cursor to the beginning of the input prompt. This provides an alternative to the existing "Ctrl+A" shortcut for the same functionality. A corresponding test case has been added to verify the new key binding.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Adds support for the 'End' key to move the cursor to the end of the input line in the interactive prompt. This enhances user experience by providing a common and intuitive keyboard shortcut, complementing the existing `Ctrl+E` binding.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for the "Home" and "End" keys in the input prompt, aliasing them to the existing Ctrl+A and Ctrl+E shortcuts. There are redundant calls to buffer.move() in the implementation where both buffer.move() and buffer.moveToOffset() are called for these key presses. The move() call is unnecessary as moveToOffset() already achieves the desired behavior of moving to the start/end of the entire buffer. This redundancy can lead to confusion and future maintenance issues. I've suggested removing the redundant calls and the corresponding test expectations to improve code clarity and correctness.
Fix unit-tests according to review
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds support for the 'Home' and 'End' keys to the input prompt, allowing the user to move the cursor to the beginning or end of the entire input text. This provides an alternative to the existing 'Ctrl+A' and 'Ctrl+E' shortcuts. The changes include updating the key handling logic and adding corresponding test cases.
My review found an issue in the implementation where a redundant function call is made in both the 'Home' and 'End' key handlers. While this doesn't break the functionality, it's a logic flaw that should be corrected for code clarity and maintainability.
|
gemini /review - review only code that belongs to the PR - do NOT review code that is NOT part of the PR |
|
gemini /review |
Adds support for the "Home" key to move the cursor to the beginning of the input prompt.
This provides an alternative to the existing "Ctrl+A" shortcut for the same functionality. A corresponding test case has been added to verify the new key binding.
#2193
TLDR
Dive Deeper
Reviewer Test Plan
Testing Matrix
Linked issues / bugs