diff --git a/src/insexpand.c b/src/insexpand.c index 35068cdae6..286fc0b472 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -2511,7 +2511,10 @@ ins_compl_new_leader(void) save_w_wrow = curwin->w_wrow; save_w_leftcol = curwin->w_leftcol; compl_restarting = TRUE; - compl_autocomplete = ins_compl_has_autocomplete(); + if (ins_compl_has_autocomplete()) + ins_compl_enable_autocomplete(); + else + compl_autocomplete = FALSE; if (ins_complete(Ctrl_N, FALSE) == FAIL) compl_cont_status = 0; compl_restarting = FALSE; @@ -3100,8 +3103,7 @@ ins_compl_prep(int c) if (ctrl_x_mode_not_defined_yet() || (ctrl_x_mode_normal() && !compl_started)) { - compl_get_longest = (get_cot_flags() & COT_LONGEST) - && !ins_compl_has_autocomplete(); + compl_get_longest = (get_cot_flags() & COT_LONGEST); compl_used_match = TRUE; } @@ -7388,6 +7390,7 @@ ins_compl_enable_autocomplete(void) { #ifdef ELAPSED_FUNC compl_autocomplete = TRUE; + compl_get_longest = FALSE; #endif } diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index e6abe98e4a..e7346b8b58 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -5871,7 +5871,7 @@ func Test_autocomplete_longest() call feedkeys("Go\", 'tx') call DoTest("f\\\\\\", 'foo', 3) - " Issue #18410: When both 'preinsert' and 'longest' are set, 'preinsert' + " Issue #18410: When both "preinsert" and "longest" are set, "preinsert" " takes precedence %delete set autocomplete completeopt+=longest,preinsert @@ -5922,6 +5922,21 @@ func Test_autocomplete_longest() %delete _ delfunc CheckUndo + " Check that behavior of "longest" in manual completion is unchanged. + for ac in [v:false, v:true] + let &ac = ac + set completeopt=menuone,longest + call feedkeys("Ssign u\\", 'tx') + call assert_equal('sign un', getline('.')) + call feedkeys("Ssign u\\\", 'tx') + call assert_equal('sign undefine', getline('.')) + call feedkeys("Ssign u\\\\", 'tx') + call assert_equal('sign unplace', getline('.')) + call feedkeys("Ssign u\\\\\", 'tx') + call assert_equal('sign u', getline('.')) + %delete + endfor + bw! set cot& autocomplete& delfunc GetLine diff --git a/src/version.c b/src/version.c index aa81346d9d..b82a01a92f 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1810, /**/ 1809, /**/