[vim/vim] Whole-page scrolling is off by one line (Issue #14585)

27 views
Skip to first unread message

Mathias Rav

unread,
Apr 18, 2024, 9:16:56 AMApr 18
to vim/vim, Subscribed

Steps to reproduce

  1. Open Vim 9.1.0346 to a buffer of 1000 lines: git checkout v9.1.0346 && make -j && make install prefix=$HOME/myvim && seq 1000 | ~/myvim/bin/vim --clean -
  2. Press CTRL-F CTRL-B

Expected behaviour

Same behavior as v9.1.0210: After pressing CTRL-F, the cursor is at first line of the screen, and after pressing CTRL-B, the cursor is at the last line of the screen (in my case, line 40 on a window that shows 40 lines)

Actual behavior since v9.1.0211: After pressing CTRL-F, the cursor is at first line of the screen, and after pressing CTRL-B, the cursor is at the second-to-last line of the screen (in my case, line 39 on a window that shows 40 lines)

Version of Vim

9.1.0346

Environment

Arch Linux, GNOME Terminal

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585@github.com>

Mathias Rav

unread,
Apr 18, 2024, 9:21:41 AMApr 18
to vim/vim, Subscribed

(Aside 1: I was about to file an issue with half-page scrolling against v9.1.0252 (currently the version in Arch) as well, but it seems like that is fixed in v9.1.0346, so I just need to wait for Arch Linux to rebuild the package.)

(Aside 2: Maybe I'm misremembering, but I think that older versions of Vim (before v9.1.0151) scrolled whole window minus one line when doing whole-page scrolling with CTRL-F and CTRL-B, but current version seems to do whole window minus two lines. It's not something that's critical for my use of Vim so I'm not going to file an issue for that.)


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063855090@github.com>

zeertzjq

unread,
Apr 18, 2024, 9:26:19 AMApr 18
to vim/vim, Subscribed

I checked a 40-line window created using the following script:

40new
call setline(1, range(1, 1000))

On both v9.1.0151 and v9.1.0252, Ctrl-F changes topline from line 1 to line 39.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063864306@github.com>

Mathias Rav

unread,
Apr 18, 2024, 9:29:31 AMApr 18
to vim/vim, Subscribed

Hi @zeertzjq, thanks for the quick reply. Perhaps my bug report was unclear. The problem arises when pressing CTRL-F followed by CTRL-B. After CTRL-B, I expect the cursor to be on the bottommost visible line on the screen, and NOT the second line from the bottom of the screen.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063871205@github.com>

luukvbaal

unread,
Apr 18, 2024, 9:31:40 AMApr 18
to vim/vim, Subscribed

Yes, I can confirm the cursor behavior difference. The "overlap" you mention in your second comment is handled by get_scroll_overlap() (it depends on the window size and what lines are in the viewport) and I think behaves similarly to older versions after it was restored.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063875729@github.com>

zeertzjq

unread,
Apr 18, 2024, 9:34:22 AMApr 18
to vim/vim, Subscribed

Oops, I didn't notice that you were talking about the cursor. This seems to differ with scrolloff=0:

set scrolloff=0
40new
call setline(1, range(1, 1000))


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063881156@github.com>

luukvbaal

unread,
Apr 18, 2024, 9:39:31 AMApr 18
to vim/vim, Subscribed

I can try to restore the cursor behavior although I still think we could benefit from a discussion in unifying the cursor behavior across the various ways to scroll the window. There was some amount of backlash against changing the behavior for Ctrl-D/U, would this backlash also be there for making Ctrl-F/B/Y/E behave as Ctrl-D/U?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063892191@github.com>

luukvbaal

unread,
Apr 18, 2024, 9:47:08 AMApr 18
to vim/vim, Subscribed

and after pressing CTRL-B, the cursor is at the last line of the screen (in my case, line 40 on a window that shows 40 lines)

I also wonder why this happened. The help for CTRL-B does not mention anything about moving the cursor. So isn't it strange that it moved the cursor to line 40 while line 39 is still visible?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063908027@github.com>

Mathias Rav

unread,
Apr 18, 2024, 10:06:56 AMApr 18
to vim/vim, Subscribed

I can try to restore the cursor behavior although I still think we could benefit from a discussion in unifying the cursor behavior across the various ways to scroll the window. There was some amount of backlash against changing the behavior for Ctrl-D/U, would this backlash also be there for making Ctrl-F/B/Y/E behave as Ctrl-D/U?

I don't think Vim should change core movement/editing behavior in the name of "unifying the various ways to do x", and I think that includes the difference in behavior of one line vs half page vs whole page scrolling. For new users, sure, the odd differences in similar operations is odd, but from my point of view I don't think Vim should cater to new users. For old users like myself with ingrained muscle memory, Vim is a constant in a rapidly evolving landscape, so these small changes are quite disruptive. If I wanted to reach for hyperbole, I would say something like "unifying scrolling? What's next - unifying the difference between cw and dw?" - but I understand that it's more nuanced than that. What do you think?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063950813@github.com>

luukvbaal

unread,
Apr 18, 2024, 10:17:02 AMApr 18
to vim/vim, Subscribed

I mean to me the difference in behavior just feels like an oversight. Obviously cw and dw are intentionally different. I think the fact that backwards compatibility seems to trump making a decision that could improve the behavior is unfortunate. There could even some kind of 'scrollcursor' option to choose the desired behavior and keep the old behavior when unset but TBH that isn't even worth it. I'll make a patch to restore the old behavior.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2063980617@github.com>

Christian Brabandt

unread,
Apr 18, 2024, 10:33:25 AMApr 18
to vim/vim, Subscribed

Thanks, I very much appreciate it!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2064019960@github.com>

Christian Brabandt

unread,
Apr 20, 2024, 11:41:25 AMApr 20
to vim/vim, Subscribed

Closed #14585 as completed via 4b6b0c4.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/14585/issue_event/12548080655@github.com>

Asheq Imran

unread,
Jun 30, 2024, 1:21:05 AM (3 days ago) Jun 30
to vim/vim, Subscribed

@luukvbaal @chrisbra Pressing when the window is already scrolled all the way to the top of the buffer moves the cursor to the bottom of the window. I don't think this is intended.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2198437350@github.com>

luukvbaal

unread,
Jul 2, 2024, 8:18:06 PM (4 hours ago) Jul 2
to vim/vim, Subscribed

I think you're right @Asheq. #15139 should fix that.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14585/2204761099@github.com>

Reply all
Reply to author
Forward
0 new messages