diff options
| author | luukvbaal <luukvbaal@gmail.com> | 2024-12-06 13:07:52 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-06 04:07:52 -0800 |
| commit | e788d1a3a903ed176a4b20891dd99272596f22d0 (patch) | |
| tree | be713dc2c345c759611bf6a156b92d22d0809f33 /test/functional/editor/completion_spec.lua | |
| parent | e9f4ceeb7467364554ecef770fd3380e89457abb (diff) | |
| download | rneovim-e788d1a3a903ed176a4b20891dd99272596f22d0.tar.gz rneovim-e788d1a3a903ed176a4b20891dd99272596f22d0.tar.bz2 rneovim-e788d1a3a903ed176a4b20891dd99272596f22d0.zip | |
fix(completion): avoid deleting text when completion leader changes #31448
Problem: When completion leader changes, text that might be reinserted
immediately after is deleted. This unnecessarily affects
extmarks. #31387 restored the original extmarks but that
prevents end_right_gravity marks from growing.
Solution: Avoid deleting leader text that will be reinserted.
Diffstat (limited to 'test/functional/editor/completion_spec.lua')
| -rw-r--r-- | test/functional/editor/completion_spec.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua index eb23de2007..c20d925713 100644 --- a/test/functional/editor/completion_spec.lua +++ b/test/functional/editor/completion_spec.lua @@ -1265,7 +1265,7 @@ describe('completion', function() 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_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 @@ -1312,5 +1312,18 @@ describe('completion', function() {5:-- Keyword completion (^N^P) }{19:Back at original} | ]], }) + -- But still grows with end_right_gravity #31437 + command( + "call nvim_buf_set_extmark(0, ns_id, 1, 0, { 'end_col':2, 'hl_group':'Error', 'end_right_gravity': 1 })" + ) + feed('<Esc>ji<C-N>a') + screen:expect({ + grid = [[ + {9:aa}aaa | + {9:aaa}^aa | + aaaaa | + {5:-- INSERT --} | + ]], + }) end) end) |