vim-patch:9.1.1378: sign without text overwrites number option (#33942)

Problem:  When 'signcolumn' is set to `number` but a line has a sign
          without text, the line number disappears (finite-state-machine)
Solution: Verify that a sign actually contains text before rendering the
          line number (glepnir)

fixes: vim/vim#17169
closes: vim/vim#17282

1b186833c1

Co-authored-by: glepnir <glephunter@gmail.com>
This commit is contained in:
zeertzjq
2025-05-10 22:12:07 +08:00
committed by GitHub
parent f38f92931a
commit 8605f5655b
2 changed files with 20 additions and 0 deletions

View File

@@ -359,6 +359,7 @@ describe('Signs', function()
]])
end)
-- oldtest: Test_sign_number_without_signtext()
it('ignores signs with no icon and text when calculating the signcolumn width', function()
feed('ia<cr>b<cr>c<cr><esc>')
exec([[

View File

@@ -2073,4 +2073,23 @@ func Test_sign_null_list()
eval v:_null_list->sign_unplacelist()
endfunc
func Test_sign_number_without_signtext()
CheckScreendump
CheckRunVimInTerminal
let lines =<< trim END
set number signcolumn=number
call setline(1, ['a', 'b', 'c'])
sign define SignA text=>> texthl=Search numhl=Error
sign define SignB numhl=Error
sign place 1 line=1 name=SignA buffer=1
sign place 2 line=2 name=SignB buffer=1
END
call writefile(lines, 'XtestSigncolumnNumber', 'D')
let buf = RunVimInTerminal('-S XtestSigncolumnNumber', {'rows': 5})
call VerifyScreenDump(buf, 'Test_sign_number_without_signtext', {})
call StopVimInTerminal(buf)
endfunc
" vim: shiftwidth=2 sts=2 expandtab