Problem: With 'smoothscroll' the position in a long line is lost when a
window is split and closed again.
Solution: With 'splitkeep' "screen" keep the skipped columns, they are part
of keeping the same screen lines. Otherwise put the cursor in the
row that keeps its relative position, instead of the last row.
This was in todo.txt, the entry is removed.
With 'smoothscroll' and a line longer than the window, ":split" followed by
":close" moved the view back by several screen lines. With a window of 23
lines and 'columns' 80, the skipped columns went from 800 to 160.
For 'splitkeep' "screen" win_fix_scroll() keeps the same screen lines by
moving the cursor to the last line and scrolling to it; that recomputes the
skipped columns for a position which is not where the cursor is. The cursor
is put back afterwards, now the skipped columns are as well, when the topline
did not change. The position is now kept exactly.
For 'splitkeep' "cursor" scroll_to_fraction() put the cursor in the last row
of the window when the cursor line does not fit, instead of the row that
keeps its relative position. With the example above the skipped columns are
now 880 instead of 160; the remaining difference of one screen line is the
resolution of the fraction.
The second change also applies without 'smoothscroll', where the skipped
columns are used to keep the cursor visible in a line that is longer than
the window.
https://github.com/vim/vim/pull/20912
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()