Skip to content

Fix display of wrapped lines at file end#112

Merged
hgwr merged 1 commit intomainfrom
codex/fix-line-wrapping-issue-in-readme.md
Aug 9, 2025
Merged

Fix display of wrapped lines at file end#112
hgwr merged 1 commit intomainfrom
codex/fix-line-wrapping-issue-in-readme.md

Conversation

@hgwr
Copy link
Owner

@hgwr hgwr commented Aug 9, 2025

Summary

  • ensure window scrolls to show full line when moving to last line
  • add regression test for wrapped last line visibility

Testing

  • cargo build --verbose
  • cargo test --verbose
  • pip install -r e2e/requirements.txt
  • pytest -n auto e2e --verbose

https://chatgpt.com/codex/tasks/task_e_6896f01032fc832f8558a1c7653b997a

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NextLine command'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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +162 to +163
let mut next_line_height =
get_line_height(next_line, editor.terminal_size.width) as u16;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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;

@hgwr hgwr merged commit ac8e8c0 into main Aug 9, 2025
2 checks passed
@hgwr hgwr deleted the codex/fix-line-wrapping-issue-in-readme.md branch August 9, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant