Smooth scroll issue

52 views
Skip to first unread message

Ernie Rael

unread,
Oct 21, 2022, 8:26:43 PM10/21/22
to vim...@googlegroups.com

(got my system back from the shop; so good)

Given: "xxx" is a file with a single line covering 4 screen lines
Do:

gvim -u NONE -U NONE xxx
:set smoothscroll
Ctrl-E

Note that cursor starts at beginning of line, column 0.

After entering Ctrl-E, observe cursor is on 2nd screen line column 0.

It should be on the 1st screen line column 3, just after "<<<".

-ernie

Ernie Rael

unread,
Oct 21, 2022, 8:32:27 PM10/21/22
to vim...@googlegroups.com
Sorry, forgot version.

That's for vim v9.0.814

-ernie
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/97ff0842-69c1-67ec-e4bb-935c31becf3d%40raelity.com.


Ernie Rael

unread,
Oct 24, 2022, 3:33:05 PM10/24/22
to vim...@googlegroups.com
On 22/10/21 5:26 PM, Ernie Rael wrote:

There is already a test for this. But the screen dump for it is wrong. Opened PR

Error in screen dump for Test_smoothscroll_one_long_line.
https://github.com/vim/vim/pull/11436

that has corrected dump so now the test fails. I'm not too familiar with the screen dump stuff so don't be too trusting

-ernie

Bram Moolenaar

unread,
Oct 27, 2022, 2:46:03 PM10/27/22
to vim...@googlegroups.com, Ernie Rael
I thought this was nicer

--
Kiss me twice. I'm schizophrenic.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ernie Rael

unread,
Oct 29, 2022, 4:23:41 PM10/29/22
to vim...@googlegroups.com
On 22/10/27 11:45 AM, Bram Moolenaar wrote:
>> (got my system back from the shop; so good)
>>
>> Given: "xxx" is a file with a single line covering 4 screen lines
>> Do:
>>
>> gvim -u NONE -U NONE xxx
>> :set smoothscroll
>> Ctrl-E
>>
>> Note that cursor starts at beginning of line, column 0.
>>
>> After entering Ctrl-E, observe cursor is on 2nd screen line column 0.
>>
>> It should be on the 1st screen line column 3, just after "<<<".
> I thought this was nicer
>
I see. It also happens when "showbreak=+++", in that case skipping a
screen line doesn't look right to me.

-ernie

Bram Moolenaar

unread,
Oct 29, 2022, 6:05:15 PM10/29/22
to vim...@googlegroups.com, Ernie Rael
You mean putting the cursor below the +++, instead of right of it?
Since the scrolling is up-down I think it's logical that the cursor is
moved down, not right. Isn't that happening? Please give a repro
example if needed.

--
BEDEVERE: Wait. Wait ... tell me, what also floats on water?
ALL: Bread? No, no, no. Apples .... gravy ... very small rocks ...
ARTHUR: A duck.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Bram Moolenaar

unread,
Nov 17, 2022, 2:01:08 PM11/17/22
to vim...@googlegroups.com, Ernie Rael
Looking at the initial issue text:

After entering Ctrl-E, observe cursor is on 2nd screen line column 0.
It should be on the 1st screen line column 3, just after "<<<".

I think one can argue for either to be right. Depends on what you
expect or what you think is more important.

My opinion is that the CTRL-E command scrolls vertically. Then moving
the cursor horizontally seems wrong, it should just move up/down so that
it is in the visible part of the line. This also matters for when
scrolling in the opposite direction next, leaving the cursor in the
third screen column seems wrong to me.

The images in pull request #11436 appear to use the option setting:

set showbreak=+++\

This is a completely different situation, since after CTRL-E the cursor
can't possibly be in the first screen column.

Currently it goes to the second screen line, while it could have been
placed in the first screen line, closer to where it was. I can't think
of a reason to move it further down, so that is something we probably
want to change.

I'll make a test that has the wrong result, so that it's easier to fix
it and check.

--
The sooner you fall behind, the more time you'll have to catch up.

Yee Cheng Chin

unread,
Nov 18, 2022, 12:09:12 AM11/18/22
to vim...@googlegroups.com, Ernie Rael
FWIW this is what my PR (https://github.com/vim/vim/pull/11504) is attempting to fix. It fixes the logic to only move two cursors down when necessary (i.e. when the cursor would have been obscured by the <<< marker).

The previous behavior arguably was a bug, because when "set number" was set, the "<<<" is displayed on the left and wouldn't interfere with the normal display of text. The code doesn't take that into account and still has explicit logic to check for "First 3 columns from the left should move down another cursor", which would only be correct if we didn't have "set number" or foldcolumns/signs/etc.

The PR adds a new function (smoothscroll_marker_overlap) which calculates the correct number of columns to move down extra cursor row so that it would work correctly for both the "set number" and "set showbreak=+++" situation. I also updated the test you added to now behave correctly.

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages