vim-patch:9.1.1752: tests: need another test for v9.1.1750 behaviour

Problem:  tests: No test when deleting text after autocompletion with preinsert
          did complete an entry
Solution: Verify, that after deletion autocompletion does not reinsert
          the deleted text. Note: the actual issue was fixed with v9.1.1750.
          (Girish Palya)

Pre v9.1.1750 behaviour:
When autocomplete is enabled with *preinsert*, deleting text after selecting a
longer match could cause unintended reinsertion, e.g.:

- Matches available: "foo" and "foobar".
- User selects "foobar" with Ctrl-N
- User deletes characters back to "foo".
- Autocomplete then incorrectly re-inserts "bar", preventing deletion past "foo".

v9.1.1750 removes the unwanted reinsertion so text can be deleted correctly.

closes: vim/vim#18259

fe0061c609

Co-authored-by: Girish Palya <girishji@gmail.com>
This commit is contained in:
zeertzjq
2025-09-11 07:18:00 +08:00
parent 5a7586a109
commit aa33ea86e1

View File

@@ -5755,6 +5755,12 @@ func Test_autocomplete_completeopt_preinsert()
call feedkeys($"cwch\<C-N>\<Esc>n.n.", 'tx')
call assert_equal(repeat(['changed'], 3), getline(1, 3))
" Select a match and delete up to text equal to another match
%delete
call setline(1, ["foobar", "foo"])
call feedkeys("Go\<ESC>", 'tx')
call DoTest("f\<C-N>\<C-N>\<BS>\<BS>\<BS>\<BS>", 'foo', 3)
%delete _
let &l:undolevels = &l:undolevels
normal! ifoo