Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @hgwr, 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!
I've addressed an issue where wrapped lines, particularly at the end of a file, might not be fully visible when navigating to them. My changes ensure that the terminal window automatically scrolls to accommodate the entire line, providing a better user experience. This includes a core logic update and a new test to confirm the fix.
Highlights
- Enhanced Scrolling for Wrapped Lines: I've implemented a fix in the
NextLinecommand's execution logic to ensure that when the cursor moves to a new line, especially a wrapped one, the entire line is visible on the screen. This is achieved by dynamically adjusting the window's scroll position if the line would otherwise extend beyond the bottom of the terminal. - New Regression Test for Visibility: To prevent regressions and validate the new scrolling behavior, I've added a new end-to-end test,
test_last_line_wrapped_visible. This test specifically verifies that a long line at the end of a file, which wraps across multiple display rows, is fully shown when the cursor navigates to it.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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 or fill out our survey to provide feedback.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where a long, wrapped line at the end of a file might not be fully visible after navigating to it. The change modifies the NextLine command to ensure the window scrolls sufficiently to display the entire wrapped line. A new end-to-end test is also added to verify this behavior and prevent regressions.
The implementation in src/command/commands/move_cursor.rs correctly adjusts the window position. I have one minor suggestion to improve code quality by removing an unnecessary mutable variable declaration. The new test case in e2e/test_wrapping.py is well-written and covers the scenario effectively. Overall, this is a good fix.
| let mut next_line_height = | ||
| get_line_height(next_line, editor.terminal_size.width) as u16; |
There was a problem hiding this comment.
The variable next_line_height is declared as mutable but is never reassigned. The mut keyword can be removed to avoid a compiler warning and improve code clarity.
| let mut next_line_height = | |
| get_line_height(next_line, editor.terminal_size.width) as u16; | |
| let next_line_height = | |
| get_line_height(next_line, editor.terminal_size.width) as u16; |
Summary
Testing
cargo build --verbosecargo test --verbosepip install -r e2e/requirements.txtpytest -n auto e2e --verbosehttps://chatgpt.com/codex/tasks/task_e_6896f01032fc832f8558a1c7653b997a