Skip to content

Commit 3c80227

Browse files
zeertzjqbrammool
authored andcommitted
patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'
Problem: Display wrong when scrolling multiple lines with 'smoothscroll' set. Solution: Redraw when w_skipcol changed. (closes #12477, closes #12468)
1 parent ecb87dd commit 3c80227

5 files changed

Lines changed: 49 additions & 3 deletions

File tree

src/move.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,7 @@ scrollup(
17851785
int width2 = width1 + curwin_col_off2();
17861786
int size = 0;
17871787
linenr_T prev_topline = curwin->w_topline;
1788+
colnr_T prev_skipcol = curwin->w_skipcol;
17881789

17891790
if (do_sms)
17901791
size = linetabsize(curwin, curwin->w_topline);
@@ -1847,8 +1848,9 @@ scrollup(
18471848
}
18481849
}
18491850

1850-
if (curwin->w_topline == prev_topline)
1851-
// need to redraw even though w_topline didn't change
1851+
if (curwin->w_topline == prev_topline
1852+
|| curwin->w_skipcol != prev_skipcol)
1853+
// need to redraw because wl_size of the topline may now be invalid
18521854
redraw_later(UPD_NOT_VALID);
18531855
}
18541856
else
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
> +8&#ffffff0@39
2+
| +0&&@39
3+
|a@39
4+
@10| @29
5+
@40
6+
@40
7+
@40
8+
@40
9+
|b@2| @36
10+
@22|1|,|0|-|1| @8|T|o|p|
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
2+
| +0&&@39
3+
@40
4+
@40
5+
@40
6+
|b@2| @36
7+
|c@2| @36
8+
|~+0#4040ff13&| @38
9+
|~| @38
10+
| +0#0000000&@21|3|,|5|0| @9|B|o|t|

src/testdir/test_scroll_opt.vim

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ func Test_smoothscroll_incsearch()
777777
call setline(14, 'bbbb')
778778
END
779779
call writefile(lines, 'XSmoothIncsearch', 'D')
780-
let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols:40})
780+
let buf = RunVimInTerminal('-S XSmoothIncsearch', #{rows: 8, cols: 40})
781781

782782
call term_sendkeys(buf, "/b")
783783
call VerifyScreenDump(buf, 'Test_smooth_incsearch_1', {})
@@ -792,4 +792,26 @@ func Test_smoothscroll_incsearch()
792792
call StopVimInTerminal(buf)
793793
endfunc
794794

795+
" Test scrolling multiple lines and stopping at non-zero skipcol.
796+
func Test_smoothscroll_multi_skipcol()
797+
CheckScreendump
798+
799+
let lines =<< trim END
800+
setlocal cursorline scrolloff=0 smoothscroll
801+
call setline(1, repeat([''], 9))
802+
call setline(3, repeat('a', 50))
803+
call setline(8, 'bbb')
804+
call setline(9, 'ccc')
805+
redraw
806+
END
807+
call writefile(lines, 'XSmoothMultiSkipcol', 'D')
808+
let buf = RunVimInTerminal('-S XSmoothMultiSkipcol', #{rows: 10, cols: 40})
809+
call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_1', {})
810+
811+
call term_sendkeys(buf, "3\<C-E>")
812+
call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {})
813+
814+
call StopVimInTerminal(buf)
815+
endfunc
816+
795817
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ static char *(features[]) =
695695

696696
static int included_patches[] =
697697
{ /* Add new patch number below this line */
698+
/**/
699+
1603,
698700
/**/
699701
1602,
700702
/**/

0 commit comments

Comments
 (0)