]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1752: tests: need another test for v9.1.1750 behaviour v9.1.1752
authorGirish Palya <girishji@gmail.com>
Wed, 10 Sep 2025 08:12:16 +0000 (04:12 -0400)
committerChristian Brabandt <cb@256bit.org>
Wed, 10 Sep 2025 08:12:16 +0000 (04:12 -0400)
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: #18259

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_ins_complete.vim
src/version.c

index 193775d1ce2af5541bedbf9424952d2566a29f71..a5e7a8b81c350539f3152d613973ebceab667ec7 100644 (file)
@@ -5642,6 +5642,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
index c74490c3eaccafd6fa0cb3fd335bedfe25d0fe16..7c186513b374e35a54de4e1fb21148d1be2f6b80 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1752,
 /**/
     1751,
 /**/