Skip to content

fix(editor): reveal wrapped final lines - #301

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/wrap-final-line
Aug 21, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/wrap-final-line

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

When a file's final line starts on the bottom screen row, wrapping renders only its first segment and leaves the rest below the viewport. This happens whether wrapping is enabled by default or toggled on later, and whether or not the file ends with a newline.

What Changed

  • Scroll earlier rows out of view until the final wrapped segment becomes visible, without scrolling the cursor's segment offscreen.
  • Keep the cursor visible when the final line is taller than the entire viewport.
  • Cover default and toggled wrapping with and without a trailing newline, and preserve hidden-segment navigation coverage for non-final lines.

How to Test

  1. Open a file in a narrow editor with several short lines followed by a final line wider than the text area. Move to the final line with wrapping enabled by default and verify its continuation rows appear instead of stopping at the bottom screen row.
  2. Start with wrapping disabled, move to the same final line, and run :wrap. Verify the final line reflows and its continuation rows become visible.
  3. Repeat both cases with and without a trailing newline. Use a final line taller than the viewport and verify the cursor remains visible while the available rows fill with wrapped text.
  4. Run cargo test --test movement --test editing; all 126 movement tests and 353 editing tests should pass.

@fcoury-oai
fcoury-oai merged commit c7408b2 into main Aug 21, 2026
10 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/wrap-final-line branch August 21, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant