0
0
mirror of https://github.com/vim/vim.git synced 2025-08-26 20:03:41 -04:00

patch 9.0.1610: display is wrong when 'smoothscroll' is set

Problem:    Display is wrong when 'smoothscroll' is set and scrolling multiple
            lines.
Solution:   Redraw with UPD_NOT_VALID when "skipcol" is or was set.
            (closes #12490, closes #12468)
This commit is contained in:
zeertzjq 2023-06-05 18:41:35 +01:00 committed by Bram Moolenaar
parent f7ca56f719
commit d9a92dc70b
6 changed files with 26 additions and 12 deletions

View File

@ -1786,7 +1786,6 @@ scrollup(
int width1 = curwin->w_width - curwin_col_off(); int width1 = curwin->w_width - curwin_col_off();
int width2 = width1 + curwin_col_off2(); int width2 = width1 + curwin_col_off2();
int size = 0; int size = 0;
linenr_T prev_topline = curwin->w_topline;
colnr_T prev_skipcol = curwin->w_skipcol; colnr_T prev_skipcol = curwin->w_skipcol;
if (do_sms) if (do_sms)
@ -1850,10 +1849,9 @@ scrollup(
} }
} }
// TODO: is comparing w_topline with prev_topline still needed? if (prev_skipcol > 0 || curwin->w_skipcol > 0)
if (curwin->w_topline == prev_topline // need to redraw more, because wl_size of the (new) topline may
|| curwin->w_skipcol != prev_skipcol) // now be invalid
// need to redraw because wl_size of the topline may now be invalid
redraw_later(UPD_NOT_VALID); redraw_later(UPD_NOT_VALID);
} }
else else

View File

@ -2,8 +2,8 @@
| +0&&@39 | +0&&@39
|a@39 |a@39
@10| @29 @10| @29
@40 |a@39
@40 @10| @29
@40 @40
@40 @40
|b@2| @36 |b@2| @36

View File

@ -1,6 +1,6 @@
|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29 |<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
| +0&&@39 |a+0&&@39
@40 @10| @29
@40 @40
@40 @40
|b@2| @36 |b@2| @36

View File

@ -0,0 +1,10 @@
|<+0#4040ff13#ffffff0@2|a+8#0000000&@5>a| @29
| +0&&@39
@40
|b@2| @36
|c@2| @36
|~+0#4040ff13&| @38
|~| @38
|~| @38
|~| @38
| +0#0000000&@21|4|,|5|0| @9|B|o|t|

View File

@ -798,10 +798,11 @@ func Test_smoothscroll_multi_skipcol()
let lines =<< trim END let lines =<< trim END
setlocal cursorline scrolloff=0 smoothscroll setlocal cursorline scrolloff=0 smoothscroll
call setline(1, repeat([''], 9)) call setline(1, repeat([''], 8))
call setline(3, repeat('a', 50)) call setline(3, repeat('a', 50))
call setline(8, 'bbb') call setline(4, repeat('a', 50))
call setline(9, 'ccc') call setline(7, 'bbb')
call setline(8, 'ccc')
redraw redraw
END END
call writefile(lines, 'XSmoothMultiSkipcol', 'D') call writefile(lines, 'XSmoothMultiSkipcol', 'D')
@ -811,6 +812,9 @@ func Test_smoothscroll_multi_skipcol()
call term_sendkeys(buf, "3\<C-E>") call term_sendkeys(buf, "3\<C-E>")
call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {}) call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_2', {})
call term_sendkeys(buf, "2\<C-E>")
call VerifyScreenDump(buf, 'Test_smooth_multi_skipcol_3', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
endfunc endfunc

View File

@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1610,
/**/ /**/
1609, 1609,
/**/ /**/