vim-patch:9.1.1836: 'culopt' "screenline" not redrawn with line("w0") and :retab

Problem:  'cursorlineopt' "screenline" isn't redrawn when moving cursor
          and then using line("w0") and :retab that does nothing.
Solution: Call redraw_for_cursorcolumn() when setting a valid w_virtcol
          (zeertzjq).

closes: vim/vim#18506

a084914361
This commit is contained in:
zeertzjq
2025-10-08 06:51:15 +08:00
parent 236d831d77
commit ba47cb7eda
6 changed files with 70 additions and 25 deletions

View File

@@ -1065,25 +1065,6 @@ describe('CursorLine and CursorLineNr highlights', function()
{101: }{100:>>>}aaaaaaaaaaaa |
|
]])
command('inoremap <F2> <Cmd>call cursor(1, 1)<CR>')
feed('A')
screen:expect([[
{103:0 }øøøøøøøøøøøøøøøøøø|
{101: }{100:>>>}{102:øøøøøøøøøøøø^ }|
{101:1 }aaaaaaaaaaaaaaaaaa|
{101: }{100:>>>}aaaaaaaaaaaa |
{5:-- INSERT --} |
]])
feed('<F2>')
screen:expect([[
{103:0 }{102:^øøøøøøøøøøøøøøøøøø}|
{101: }{100:>>>}øøøøøøøøøøøø |
{101:1 }aaaaaaaaaaaaaaaaaa|
{101: }{100:>>>}aaaaaaaaaaaa |
{5:-- INSERT --} |
]])
end)
-- oldtest: Test_cursorline_screenline_resize()
@@ -1123,6 +1104,47 @@ describe('CursorLine and CursorLineNr highlights', function()
]])
end)
-- oldtest: Test_cursorline_screenline_update()
it("'cursorlineopt' screenline is updated on various movements", function()
local screen = Screen.new(75, 8)
exec([[
func TestRetab()
let w = winwidth(0)
call cursor([1, w + 1, 0, w + 1])
call line('w0')
retab 8
endfunc
call setline(1, repeat('xyz ', 30))
set cursorline cursorlineopt=screenline tabstop=8
inoremap <F2> <Cmd>call cursor(1, 1)<CR>
inoremap <F3> <Cmd>call TestRetab()<CR>
]])
feed('A')
screen:expect([[
xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz|
{21: xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz ^ }|
{1:~ }|*5
{5:-- INSERT --} |
]])
feed('<F2>')
screen:expect([[
{21:^xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz}|
xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz |
{1:~ }|*5
{5:-- INSERT --} |
]])
feed('<F3>')
screen:expect([[
xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz|
{21:^ xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz }|
{1:~ }|*5
{5:-- INSERT --} |
]])
feed('<Esc>')
end)
-- oldtest: Test_cursorline_after_yank()
it('always updated. vim-patch:8.1.0849', function()
local screen = Screen.new(50, 5)