mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-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 vim/vim#12490, closes vim/vim#12468)
d9a92dc70b
This commit is contained in:
parent
9978a9996d
commit
fc908b5006
@ -1344,7 +1344,6 @@ bool scrollup(long line_count, int byfold)
|
|||||||
int width1 = curwin->w_width_inner - curwin_col_off();
|
int width1 = curwin->w_width_inner - curwin_col_off();
|
||||||
int width2 = width1 + curwin_col_off2();
|
int width2 = width1 + curwin_col_off2();
|
||||||
unsigned size = 0;
|
unsigned size = 0;
|
||||||
linenr_T prev_topline = curwin->w_topline;
|
|
||||||
const colnr_T prev_skipcol = curwin->w_skipcol;
|
const colnr_T prev_skipcol = curwin->w_skipcol;
|
||||||
|
|
||||||
if (do_sms) {
|
if (do_sms) {
|
||||||
@ -1397,9 +1396,9 @@ bool scrollup(long line_count, int byfold)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curwin->w_topline == prev_topline
|
if (prev_skipcol > 0 || curwin->w_skipcol > 0) {
|
||||||
|| curwin->w_skipcol != prev_skipcol) {
|
// need to redraw more, because wl_size of the (new) topline may
|
||||||
// need to redraw because wl_size of the topline may now be invalid
|
// now be invalid
|
||||||
redraw_later(curwin, UPD_NOT_VALID);
|
redraw_later(curwin, UPD_NOT_VALID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -874,10 +874,11 @@ describe('smoothscroll', function()
|
|||||||
})
|
})
|
||||||
exec([[
|
exec([[
|
||||||
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
|
||||||
]])
|
]])
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
@ -885,8 +886,8 @@ describe('smoothscroll', function()
|
|||||||
|
|
|
|
||||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||||
aaaaaaaaaa |
|
aaaaaaaaaa |
|
||||||
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||||
|
|
aaaaaaaaaa |
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
bbb |
|
bbb |
|
||||||
@ -895,8 +896,8 @@ describe('smoothscroll', function()
|
|||||||
feed('3<C-E>')
|
feed('3<C-E>')
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{0:<<<}{1:aaaaaa^a }|
|
{0:<<<}{1:aaaaaa^a }|
|
||||||
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
||||||
|
|
aaaaaaaaaa |
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
bbb |
|
bbb |
|
||||||
@ -905,6 +906,19 @@ describe('smoothscroll', function()
|
|||||||
{0:~ }|
|
{0:~ }|
|
||||||
|
|
|
|
||||||
]])
|
]])
|
||||||
|
feed('2<C-E>')
|
||||||
|
screen:expect([[
|
||||||
|
{0:<<<}{1:aaaaaa^a }|
|
||||||
|
|
|
||||||
|
|
|
||||||
|
bbb |
|
||||||
|
ccc |
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
{0:~ }|
|
||||||
|
|
|
||||||
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("works with virt_lines above and below", function()
|
it("works with virt_lines above and below", function()
|
||||||
|
@ -801,10 +801,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')
|
||||||
@ -814,6 +815,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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user