vim-patch:8.2.1004: line numbers below filler lines not always updated

Problem:    Line numbers below filler lines not always updated.
Solution:   Don't break out of the win_line() loop too early. (Christian
            Brabandt, closes vim/vim#6294, closes vim/vim#6138)
511feec6f0
This commit is contained in:
Jan Edmund Lazo
2020-07-17 21:20:56 -04:00
parent 1e6bf6f17a
commit ed41ac08cf
3 changed files with 112 additions and 4 deletions

View File

@@ -3068,10 +3068,12 @@ win_line (
} }
// When still displaying '$' of change command, stop at cursor // When still displaying '$' of change command, stop at cursor
if ((dollar_vcol >= 0 && wp == curwin if (((dollar_vcol >= 0
&& lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol && wp == curwin
&& filler_todo <= 0) && lnum == wp->w_cursor.lnum
|| (number_only && draw_state > WL_NR)) { && vcol >= (long)wp->w_virtcol)
|| (number_only && draw_state > WL_NR))
&& filler_todo <= 0) {
grid_put_linebuf(grid, row, 0, col, -grid->Columns, wp->w_p_rl, wp, grid_put_linebuf(grid, row, 0, col, -grid->Columns, wp->w_p_rl, wp,
wp->w_hl_attr_normal, false); wp->w_hl_attr_normal, false);
// Pretend we have finished updating the window. Except when // Pretend we have finished updating the window. Except when

View File

@@ -1,6 +1,7 @@
" Tests for diff mode " Tests for diff mode
source shared.vim source shared.vim
source screendump.vim source screendump.vim
source check.vim
func Test_diff_fold_sync() func Test_diff_fold_sync()
enew! enew!
@@ -801,6 +802,34 @@ func Test_diff_closeoff()
enew! enew!
endfunc endfunc
func Test_diff_rnu()
CheckScreendump
let content =<< trim END
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
windo diffthis
setlocal number rnu foldcolumn=0
END
call writefile(content, 'Xtest_diff_rnu')
let buf = RunVimInTerminal('-S Xtest_diff_rnu', {})
call VerifyScreenDump(buf, 'Test_diff_rnu_01', {})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_diff_rnu_02', {})
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_diff_rnu_03', {})
" clean up
call StopVimInTerminal(buf)
call delete('Xtest_diff_rnu')
endfunc
func Test_diff_and_scroll() func Test_diff_and_scroll()
" this was causing an ml_get error " this was causing an ml_get error
set ls=2 set ls=2

View File

@@ -6,6 +6,7 @@ local clear = helpers.clear
local command = helpers.command local command = helpers.command
local insert = helpers.insert local insert = helpers.insert
local write_file = helpers.write_file local write_file = helpers.write_file
local source = helpers.source
describe('Diff mode screen', function() describe('Diff mode screen', function()
local fname = 'Xtest-functional-diff-screen-1' local fname = 'Xtest-functional-diff-screen-1'
@@ -1031,3 +1032,79 @@ it('win_update redraws lines properly', function()
| |
]]} ]]}
end) end)
it('diff updates line numbers below filler lines', function()
clear()
local screen = Screen.new(40, 14)
screen:attach()
screen:set_default_attr_ids({
[1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
[2] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
[3] = {reverse = true},
[4] = {background = Screen.colors.LightBlue},
[5] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.LightGrey},
[6] = {bold = true, foreground = Screen.colors.Blue1},
[7] = {bold = true, reverse = true},
[8] = {bold = true, background = Screen.colors.Red},
[9] = {background = Screen.colors.LightMagenta},
[10] = {bold = true, foreground = Screen.colors.Brown},
[11] = {foreground = Screen.colors.Brown},
})
source([[
call setline(1, ['a', 'a', 'a', 'y', 'b', 'b', 'b', 'b', 'b'])
vnew
call setline(1, ['a', 'a', 'a', 'x', 'x', 'x', 'b', 'b', 'b', 'b', 'b'])
windo diffthis
setlocal number rnu foldcolumn=0
]])
screen:expect([[
{1: }a {3:│}{10:1 }^a |
{1: }a {3:│}{11: 1 }a |
{1: }a {3:│}{11: 2 }a |
{1: }{8:x}{9: }{3:│}{11: 3 }{8:y}{9: }|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }b {3:│}{11: 4 }b |
{1: }b {3:│}{11: 5 }b |
{1: }b {3:│}{11: 6 }b |
{1: }b {3:│}{11: 7 }b |
{1: }b {3:│}{11: 8 }b |
{6:~ }{3:│}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
feed('j')
screen:expect([[
{1: }a {3:│}{11: 1 }a |
{1: }a {3:│}{10:2 }^a |
{1: }a {3:│}{11: 1 }a |
{1: }{8:x}{9: }{3:│}{11: 2 }{8:y}{9: }|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }b {3:│}{11: 3 }b |
{1: }b {3:│}{11: 4 }b |
{1: }b {3:│}{11: 5 }b |
{1: }b {3:│}{11: 6 }b |
{1: }b {3:│}{11: 7 }b |
{6:~ }{3:│}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
feed('j')
screen:expect([[
{1: }a {3:│}{11: 2 }a |
{1: }a {3:│}{11: 1 }a |
{1: }a {3:│}{10:3 }^a |
{1: }{8:x}{9: }{3:│}{11: 1 }{8:y}{9: }|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }{4:x }{3:│}{11: }{2:----------------}|
{1: }b {3:│}{11: 2 }b |
{1: }b {3:│}{11: 3 }b |
{1: }b {3:│}{11: 4 }b |
{1: }b {3:│}{11: 5 }b |
{1: }b {3:│}{11: 6 }b |
{6:~ }{3:│}{6:~ }|
{3:[No Name] [+] }{7:[No Name] [+] }|
|
]])
end)