vim / vim

The official Vim repository

Home Page:https://www.vim.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

smoothscroll down never leaves the line when scrolloff non zero

errael opened this issue · comments

Steps to reproduce

On a long line, continually doing gj never leaves the line. When you get close to the end of the long line, the first chars of the long line appear at the top of screen. Attached a file, but I'd guess any old file with a long line works.

gvim -u NONE -U NONE <attached_file>
set smoothscroll
set lines=22
set display=truncate
set scrolloff=3
map j gj

NOTE: change to set scrolloff=0 and it works OK.

Additionally, being at the top line of the file, doing the first gj end up on the third display line. There is no way to easily place the cursor on the first display lines.

long-line.txt

Expected behaviour

Going down one line goes down one display line.

Version of Vim

9.1.393

Environment

ubuntu/gtk

Logs and stack traces

No response

Since there is a simple workaround, do :set so=0, when you run into this issue, it's not serious. The recent smoothscroll infinite loop, #14750, reminds me of this; but this is not a vim infinite loop, more of a user loop:-)

@luukvbaal I'm only asking about this issue now to make sure it is seen. I vaguely recall something about known issues with smoothscroll and scrolloff. I couldn't find the issue; if there is one then this can be closed as duplicate.

I noticed the issue(and kept it in my inbox) but it might be a while before I will be able to look into it. I don't think there are any other open smoothscroll issues currently.

but it might be a while before I will be able to look into it.

I lied, I looked into it right after writing this and fell down the smoothscroll rabbit hole once I established that this was caused by a regression in #14410.

#14783 fixes the two problems mentioned here, and fixes one screen issue with sms + scrolloff near the end of a line(also present before #14410), while noting some additional screen problems...

down the smoothscroll rabbit hole

I turned this feature on when Bram first released it; I've seen some very bizzare things...

I tried this patch, works for me,
Thanks.

I turned this feature on when Bram first released it; I've seen some very bizzare things...

Haha same, but I meant in the code; it is still quite messy...

I tried this patch, works for me, Thanks.

Thanks for confirming the fix.

meant in the code

Me too, kind of. Assuming vim is a holographic universe, and considering what I've seen as a user for smoothscroll evolution over the last year, I'm thinking as a programmer you've seen...