From 839d919098ed2cf3dfb93b6337a3d2ea2bd210a0 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 31 Aug 2023 08:35:08 +0800 Subject: vim-patch:9.0.1825: wrong cursor position with virt text and 'linebreak' (#24957) Problem: Wrong cursor position with virtual text before a whitespace character and 'linebreak'. Solution: Always set "col_adj" to "size - 1" and apply 'linebreak' after adding the size of 'breakindent' and 'showbreak'. closes: vim/vim#12956 https://github.com/vim/vim/commit/6e55e85f92aff43c1b3cb564201440f3552d63f0 N/A patches: vim-patch:9.0.1826: keytrans() doesn't translate recorded key typed in a GUI --- test/functional/ui/decorations_spec.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test/functional') diff --git a/test/functional/ui/decorations_spec.lua b/test/functional/ui/decorations_spec.lua index 63f8c1e82c..ba8d548a57 100644 --- a/test/functional/ui/decorations_spec.lua +++ b/test/functional/ui/decorations_spec.lua @@ -3217,6 +3217,33 @@ describe('decorations: inline virtual text', function() | ]]} end) + + it('before a space with linebreak', function() + screen:try_resize(50, 6) + exec([[ + setlocal linebreak showbreak=+ breakindent breakindentopt=shift:2 + call setline(1, repeat('a', 50) .. ' ' .. repeat('c', 45)) + normal! $ + ]]) + meths.buf_set_extmark(0, ns, 0, 50, { virt_text = { { ('b'):rep(10) } }, virt_text_pos = 'inline' }) + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa| + {1:+}bbbbbbbbbb | + {1:+}cccccccccccccccccccccccccccccccccccccccccccc^c | + {1:~ }| + {1:~ }| + | + ]]} + feed('05x$') + screen:expect{grid=[[ + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbb| + {1:+}bbbbb | + {1:+}cccccccccccccccccccccccccccccccccccccccccccc^c | + {1:~ }| + {1:~ }| + | + ]]} + end) end) describe('decorations: virtual lines', function() -- cgit