patch 9.1.1747: completion: redo (.) broken with preinsert and autocompletion

Commit: 
https://github.com/vim/vim/commit/306a138172c83cebf573b2ef7f56bf94d84429cb
Author: Girish Palya <[email protected]>
Date:   Tue Sep 9 15:33:14 2025 -0400

    patch 9.1.1747: completion: redo (.) broken with preinsert and 
autocompletion
    
    Problem:  completion: redo (.) broken with preinsert and autocompletion
    Solution: Make redo (.) work with preinsert and autocompletion
              (Girish Palya)
    
    closes: #18253
    
    Signed-off-by: Girish Palya <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/insexpand.c b/src/insexpand.c
index 71b09313e..d797bc5d9 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -154,9 +154,8 @@ static string_T       compl_leader = {NULL, 0};
 static int       compl_get_longest = FALSE;    // put longest common string
                                                // in compl_leader
 
-// This flag indicates that one of the items in the match list is currently
-// selected.  FALSE when no match is selected or the match was edited or using
-// the longest common string.
+// This flag is FALSE when no match is selected (by ^N/^P) or the match was
+// edited or using the longest common string.
 static int       compl_used_match;
 
 // didn't finish finding completions.
@@ -5960,7 +5959,8 @@ ins_compl_insert(int move_cursor, int preinsert_prefix)
                curwin->w_cursor.col -= (colnr_T)(cp_str_len - leader_len);
        }
     }
-    if (match_at_original_text(compl_shown_match) || preinsert)
+    if (match_at_original_text(compl_shown_match)
+           || (preinsert && !compl_autocomplete))
        compl_used_match = FALSE;
     else
        compl_used_match = TRUE;
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index 41b223da1..193775d1c 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -5634,6 +5634,13 @@ func Test_autocomplete_completeopt_preinsert()
   " Should not work with fuzzy
   set cot+=fuzzy
   call DoTest("f", 'f', 2)
+  set cot-=fuzzy
+
+  " Verify that redo (dot) works
+  call setline(1, ["foobar", "foozbar", "foobaz", "changed", "change"])
+  call feedkeys($"/foo\<CR>", 'tx')
+  call feedkeys($"cwch\<C-N>\<Esc>n.n.", 'tx')
+  call assert_equal(repeat(['changed'], 3), getline(1, 3))
 
   %delete _
   let &l:undolevels = &l:undolevels
diff --git a/src/version.c b/src/version.c
index 7a08d7a98..44eb6d961 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1747,
 /**/
     1746,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uw4H2-00E83s-8x%40256bit.org.

Raspunde prin e-mail lui