aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2023-11-30 11:48:16 +0100
committerGitHub <noreply@github.com>2023-11-30 11:48:16 +0100
commit3b6dd8608d05aea4144cf05730e7b6c6db6052e8 (patch)
tree4249cde1a86107a20b55a457689d7f3b4a9b7032 /test
parent95dbf1af73a6f73f08f988adb6d6436d680f53c4 (diff)
parent8e97edb93f01a08b332289405f83624cfb067fcc (diff)
downloadrneovim-3b6dd8608d05aea4144cf05730e7b6c6db6052e8.tar.gz
rneovim-3b6dd8608d05aea4144cf05730e7b6c6db6052e8.tar.bz2
rneovim-3b6dd8608d05aea4144cf05730e7b6c6db6052e8.zip
Merge pull request #23657 from luukvbaal/extmark
fix(extmark): restore extmarks when completing original text
Diffstat (limited to 'test')
-rw-r--r--test/functional/editor/completion_spec.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index cbaf401f06..84af90a298 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -1257,4 +1257,48 @@ describe('completion', function()
{3:-- }{4:match 1 of 2} |
]]}
end)
+
+ it('restores extmarks if original text is restored #23653', function()
+ screen:try_resize(screen._width, 4)
+ command([[
+ call setline(1, ['aaaa'])
+ let ns_id = nvim_create_namespace('extmark')
+ let mark_id = nvim_buf_set_extmark(0, ns_id, 0, 0, { 'end_col':2, 'hl_group':'Error'})
+ let mark = nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })
+ inoremap <C-x> <C-r>=Complete()<CR>
+ function Complete() abort
+ call complete(1, [{ 'word': 'aaaaa' }])
+ return ''
+ endfunction
+ ]])
+ feed('A<C-X><C-E><Esc>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('A<C-N>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('<Esc>0Yppia<Esc>ggI<C-N>')
+ screen:expect([[
+ aaaa{7:^aa}aa |
+ {2:aaaa } |
+ {1:aaaaa } |
+ {3:-- Keyword completion (^N^P) }{4:match 1 of 2} |
+ ]])
+ feed('<C-N><C-N><Esc>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('A<C-N>')
+ eq(eval('mark'), eval("nvim_buf_get_extmark_by_id(0, ns_id, mark_id, { 'details':1 })"))
+ feed('<C-N>')
+ screen:expect([[
+ aaaaa^ |
+ {1:aaaa } |
+ {2:aaaaa } |
+ {3:-- Keyword completion (^N^P) }{4:match 2 of 2} |
+ ]])
+ feed('<C-E>')
+ screen:expect([[
+ {7:aa}aa^ |
+ aaaa |
+ aaaaa |
+ {3:-- INSERT --} |
+ ]])
+ end)
end)