diff options
author | luukvbaal <luukvbaal@gmail.com> | 2025-04-01 07:56:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 07:56:36 +0200 |
commit | 7e8b7bba21cfb0a35e442c27aec0ced1b32ce14d (patch) | |
tree | b136018030ac74e99cb41ff8b2a8d29e09d2194f /test/functional | |
parent | 32325a66ca0df66ba712b3316f24c358c4947620 (diff) | |
download | rneovim-7e8b7bba21cfb0a35e442c27aec0ced1b32ce14d.tar.gz rneovim-7e8b7bba21cfb0a35e442c27aec0ced1b32ce14d.tar.bz2 rneovim-7e8b7bba21cfb0a35e442c27aec0ced1b32ce14d.zip |
fix(display): wrong cursor column with 'concealcursor' = "n" and virt_text (#33218)
Problem: Inline virtual text placed in a decor provider callback
invalidates `w_virtcol`, which must be valid for `win_line()`.
Solution: Call `validate_virtcol()` after "line" decor provider callbacks.
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/ui/decorations_spec.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 06bb5a14c9..307f750175 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -811,6 +811,33 @@ describe('decorations providers', function() | ]]) end) + + it('inline virt_text does not result in wrong cursor column #33153', function() + insert("line1 with a lot of text\nline2 with a lot of text") + setup_provider([[ + _G.do_win = false + vim.keymap.set('n', 'f', function() + _G.do_win = true + vim.cmd('redraw!') + end) + vim.o.concealcursor = 'n' + function on_do(event) + if event == 'win' and _G.do_win then + vim.api.nvim_buf_set_extmark(0, ns1, 1, 0, { + virt_text = { { 'virt_text ' } }, + virt_text_pos = 'inline' + }) + end + end + ]]) + feed('f') + screen:expect([[ + line1 with a lot of text | + virt_text line2 with a lot of tex^t | + {1:~ }|*5 + | + ]]) + end) end) describe('decoration_providers', function() |