mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
fix(mouse): click after eol with conceal and virtual text (#27897)
Problem: Wrong cursor position when clicking after end of line with
'virtualedit', conceal and virtual text.
Solution: Always fill linebuf_vcol[] for the columns to clear.
This commit is contained in:
@@ -34,6 +34,7 @@ describe('ui/mouse/input', function()
|
||||
[6] = { foreground = Screen.colors.Grey100, background = Screen.colors.Red },
|
||||
[7] = { bold = true, foreground = Screen.colors.SeaGreen4 },
|
||||
[8] = { foreground = Screen.colors.Brown },
|
||||
[9] = { background = Screen.colors.DarkGrey, foreground = Screen.colors.LightGrey },
|
||||
})
|
||||
command('set mousemodel=extend')
|
||||
feed('itesting<cr>mouse<cr>support and selection<esc>')
|
||||
@@ -1638,6 +1639,59 @@ describe('ui/mouse/input', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('virtual text does not change cursor placement on concealed line', function()
|
||||
command('%delete')
|
||||
insert('aaaaaaaaaa|hidden|bbbbbbbbbb|hidden|cccccccccc')
|
||||
command('syntax match test /|hidden|/ conceal cchar=X')
|
||||
command('set conceallevel=2 concealcursor=n virtualedit=all')
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbbb |
|
||||
bbb{9:X}ccccccccc^c |
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 0, 22)
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbb^b |
|
||||
bbb{9:X}cccccccccc |
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 1, 16)
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbbb |
|
||||
bbb{9:X}cccccccccc ^ |
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
|
||||
api.nvim_buf_set_extmark(0, api.nvim_create_namespace(''), 0, 0, {
|
||||
virt_text = { { '?', 'ErrorMsg' } },
|
||||
virt_text_pos = 'right_align',
|
||||
virt_text_repeat_linebreak = true,
|
||||
})
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbbb {6:?}|
|
||||
bbb{9:X}cccccccccc ^ {6:?}|
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 0, 22)
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbb^b {6:?}|
|
||||
bbb{9:X}cccccccccc {6:?}|
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
api.nvim_input_mouse('left', 'press', '', 0, 1, 16)
|
||||
screen:expect([[
|
||||
aaaaaaaaaa{9:X}bbbbbbb {6:?}|
|
||||
bbb{9:X}cccccccccc ^ {6:?}|
|
||||
{0:~ }|*2
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('getmousepos() works correctly', function()
|
||||
local winwidth = api.nvim_get_option_value('winwidth', {})
|
||||
-- Set winwidth=1 so that window sizes don't change.
|
||||
|
||||
Reference in New Issue
Block a user