Skip to content

fix(navigation): handle hunks past end of buffer for deleted last lines#391

Open
marcomayer wants to merge 4 commits into
esmuellert:mainfrom
marcomayer:fix-hunks-past-end-of-buffer
Open

fix(navigation): handle hunks past end of buffer for deleted last lines#391
marcomayer wants to merge 4 commits into
esmuellert:mainfrom
marcomayer:fix-hunks-past-end-of-buffer

Conversation

@marcomayer

Copy link
Copy Markdown
Contributor

When a hunk deletes the last line(s) of a file, modified.start_line points past the buffer end. Navigation and auto-scroll silently failed because nvim_win_set_cursor rejects out-of-range lines. Now we compare against the unclamped line for ordering but clamp for cursor placement.

I stumbled over this a few times now so I checked if it's easy to fix. And I think it is, unless there are side-effects I didn't think about. Please have a look.

@marcomayer marcomayer force-pushed the fix-hunks-past-end-of-buffer branch from 618bec5 to e071a22 Compare June 7, 2026 10:03
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