vim-patch:9.1.0176: Cursor column wrong with 'virtualedit' and conceal

Problem:  Cursor column wrong with 'virtualedit' and conceal.
Solution: Correct cursor column at end of line if never reached.
          (zeertzjq)

closes: vim/vim#14190

253ff4dece
This commit is contained in:
zeertzjq
2024-03-14 06:44:41 +08:00
parent 9599e5d28d
commit 2af1dc0116
3 changed files with 149 additions and 1 deletions

View File

@@ -632,4 +632,92 @@ describe('Conceal', function()
feed('$')
expect_pos(9, 26)
end)
-- oldtest: Test_conceal_virtualedit_after_eol()
it('cursor drawn at correct column with virtualedit', function()
local screen = Screen.new(75, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
exec([[
call setline(1, 'abcdefgh|hidden|ijklmnpop')
syntax match test /|hidden|/ conceal
set conceallevel=2 concealcursor=n virtualedit=all
normal! $
]])
screen:expect([[
abcdefghijklmnpo^p |
{0:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop^ |
{0:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
{0:~ }|
|
]])
feed('l')
screen:expect([[
abcdefghijklmnpop ^ |
{0:~ }|
|
]])
feed('rr')
screen:expect([[
abcdefghijklmnpop ^r |
{0:~ }|
|
]])
end)
-- oldtest: Test_conceal_virtualedit_after_eol_rightleft()
it('cursor drawn correctly with virtualedit and rightleft', function()
local screen = Screen.new(75, 3)
screen:set_default_attr_ids({
[0] = { bold = true, foreground = Screen.colors.Blue }, -- NonText
})
screen:attach()
exec([[
call setline(1, 'abcdefgh|hidden|ijklmnpop')
syntax match test /|hidden|/ conceal
set conceallevel=2 concealcursor=n virtualedit=all rightleft
normal! $
]])
screen:expect([[
^popnmlkjihgfedcba|
{0: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
|
]])
feed('h')
screen:expect([[
^ popnmlkjihgfedcba|
{0: ~}|
|
]])
feed('rr')
screen:expect([[
^r popnmlkjihgfedcba|
{0: ~}|
|
]])
end)
end)