Skip to content

Commit 306a138

Browse files
girishjichrisbra
authored andcommitted
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 <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 80981e1 commit 306a138

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

src/insexpand.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ static string_T compl_leader = {NULL, 0};
154154
static int compl_get_longest = FALSE; // put longest common string
155155
// in compl_leader
156156

157-
// This flag indicates that one of the items in the match list is currently
158-
// selected. FALSE when no match is selected or the match was edited or using
159-
// the longest common string.
157+
// This flag is FALSE when no match is selected (by ^N/^P) or the match was
158+
// edited or using the longest common string.
160159
static int compl_used_match;
161160

162161
// didn't finish finding completions.
@@ -5960,7 +5959,8 @@ ins_compl_insert(int move_cursor, int preinsert_prefix)
59605959
curwin->w_cursor.col -= (colnr_T)(cp_str_len - leader_len);
59615960
}
59625961
}
5963-
if (match_at_original_text(compl_shown_match) || preinsert)
5962+
if (match_at_original_text(compl_shown_match)
5963+
|| (preinsert && !compl_autocomplete))
59645964
compl_used_match = FALSE;
59655965
else
59665966
compl_used_match = TRUE;

src/testdir/test_ins_complete.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5634,6 +5634,13 @@ func Test_autocomplete_completeopt_preinsert()
56345634
" Should not work with fuzzy
56355635
set cot+=fuzzy
56365636
call DoTest("f", 'f', 2)
5637+
set cot-=fuzzy
5638+
5639+
" Verify that redo (dot) works
5640+
call setline(1, ["foobar", "foozbar", "foobaz", "changed", "change"])
5641+
call feedkeys($"/foo\<CR>", 'tx')
5642+
call feedkeys($"cwch\<C-N>\<Esc>n.n.", 'tx')
5643+
call assert_equal(repeat(['changed'], 3), getline(1, 3))
56375644

56385645
%delete _
56395646
let &l:undolevels = &l:undolevels

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ static char *(features[]) =
724724

725725
static int included_patches[] =
726726
{ /* Add new patch number below this line */
727+
/**/
728+
1747,
727729
/**/
728730
1746,
729731
/**/

0 commit comments

Comments
 (0)