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

@@ -394,6 +394,10 @@ func Test_conceal_mouse_click()
syn match Concealed "this" conceal
hi link Concealed Search
" Nvim: need to redraw before processing every key, because mouse clicks set
" w_redr_type, which prevent using vcols[].
lua _G.NS = vim.on_key(function() vim.cmd.redraw() end)
" Test with both 'nocursorline' and 'cursorline', as they use two different
" code paths to set virtual columns for the cells to clear.
for cul in [v:false, v:true]
@@ -550,6 +554,8 @@ func Test_conceal_mouse_click()
setlocal number& signcolumn&
endfor
lua vim.on_key(nil, _G.NS); _G.NS = nil
call CloseWindow()
set mouse&
endfunc

View File

@@ -296,9 +296,17 @@ func Test_cursorline_screenline_update()
CheckScreendump
let lines =<< trim END
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
set cursorline cursorlineopt=screenline tabstop=8
inoremap <F2> <Cmd>call cursor(1, 1)<CR>
inoremap <F3> <Cmd>call TestRetab()<CR>
END
call writefile(lines, 'Xcul_screenline', 'D')
@@ -307,6 +315,8 @@ func Test_cursorline_screenline_update()
call VerifyScreenDump(buf, 'Test_cursorline_screenline_1', {})
call term_sendkeys(buf, "\<F2>")
call VerifyScreenDump(buf, 'Test_cursorline_screenline_2', {})
call term_sendkeys(buf, "\<F3>")
call VerifyScreenDump(buf, 'Test_cursorline_screenline_3', {})
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)