]> granicus.if.org Git - vim/commitdiff
patch 8.2.1580: wildmenu does not work properly v8.2.1580
authorBram Moolenaar <Bram@vim.org>
Thu, 3 Sep 2020 14:50:13 +0000 (16:50 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 Sep 2020 14:50:13 +0000 (16:50 +0200)
Problem:    Wildmenu does not work properly.
Solution:   Do not call may_do_incsearch_highlighting() if completion is in
            progress.

src/ex_getln.c
src/testdir/dumps/Test_wildmenu_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_2.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_3.dump [new file with mode: 0644]
src/testdir/dumps/Test_wildmenu_4.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/version.c

index 60a8a0c712bde72635d4b8e414e2d6ee228ff41d..bc193a209af4fba0ce09bf75d3044debe7f99773 100644 (file)
@@ -397,7 +397,8 @@ may_do_incsearch_highlighting(
     // NOTE: must call restore_last_search_pattern() before returning!
     save_last_search_pattern();
 
-    if (!do_incsearch_highlighting(firstc, &search_delim, is_state, &skiplen, &patlen))
+    if (!do_incsearch_highlighting(firstc, &search_delim, is_state,
+                                                           &skiplen, &patlen))
     {
        restore_last_search_pattern();
        finish_incsearch_highlighting(FALSE, is_state, TRUE);
@@ -1235,10 +1236,10 @@ getcmdline_int(
                    if (has_mbyte)
                        j -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + j);
                    if (vim_ispathsep(ccline.cmdbuff[j])
-#ifdef BACKSLASH_IN_FILENAME
+# ifdef BACKSLASH_IN_FILENAME
                            && vim_strchr((char_u *)" *?[{`$%#",
                                ccline.cmdbuff[j + 1]) == NULL
-#endif
+# endif
                       )
                    {
                        if (found)
@@ -1425,6 +1426,7 @@ getcmdline_int(
        if ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm)
        {
            int options = WILD_NO_BEEP;
+
            if (wim_flags[wim_index] & WIM_BUFLASTUSED)
                options |= WILD_BUFLASTUSED;
            if (xpc.xp_numfiles > 0)   // typed p_wc at least twice
@@ -1442,8 +1444,7 @@ getcmdline_int(
                    res = nextwild(&xpc, WILD_LONGEST, options,
                                                               firstc != '@');
                else if (wim_flags[wim_index] & WIM_FULL)
-                   res = nextwild(&xpc, WILD_NEXT, options,
-                                                              firstc != '@');
+                   res = nextwild(&xpc, WILD_NEXT, options, firstc != '@');
                else
                    res = OK;       // don't insert 'wildchar' now
            }
@@ -1454,11 +1455,10 @@ getcmdline_int(
                // if 'wildmode' first contains "longest", get longest
                // common part
                if (wim_flags[0] & WIM_LONGEST)
-                   res = nextwild(&xpc, WILD_LONGEST, options,
-                                                              firstc != '@');
+                   res = nextwild(&xpc, WILD_LONGEST, options, firstc != '@');
                else
                    res = nextwild(&xpc, WILD_EXPAND_KEEP, options,
-                                                              firstc != '@');
+                                                               firstc != '@');
 
                // if interrupted while completing, behave like it failed
                if (got_int)
@@ -1483,7 +1483,7 @@ getcmdline_int(
                        wim_index = 1;
                    if ((wim_flags[wim_index] & WIM_LIST)
 #ifdef FEAT_WILDMENU
-                           || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
+                         || (p_wmnu && (wim_flags[wim_index] & WIM_FULL) != 0)
 #endif
                            )
                    {
@@ -1511,8 +1511,7 @@ getcmdline_int(
                            nextwild(&xpc, WILD_LONGEST, options,
                                                               firstc != '@');
                        else if (wim_flags[wim_index] & WIM_FULL)
-                           nextwild(&xpc, WILD_NEXT, options,
-                                                              firstc != '@');
+                           nextwild(&xpc, WILD_NEXT, options, firstc != '@');
                    }
                    else
                        vim_beep(BO_WILD);
@@ -2348,7 +2347,8 @@ cmdline_changed:
        trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
 
 #ifdef FEAT_SEARCH_EXTRA
-       may_do_incsearch_highlighting(firstc, count, &is_state);
+       if (xpc.xp_context == EXPAND_NOTHING)
+           may_do_incsearch_highlighting(firstc, count, &is_state);
 #endif
 
 #ifdef FEAT_RIGHTLEFT
diff --git a/src/testdir/dumps/Test_wildmenu_1.dump b/src/testdir/dumps/Test_wildmenu_1.dump
new file mode 100644 (file)
index 0000000..a118969
--- /dev/null
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|v+0#0000001#ffff4012|i|m|9|s|c|r|i|p|t| +3#0000000#ffffff0@1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43
+|:+0&&|v|i|m|9|s|c|r|i|p|t> @63
diff --git a/src/testdir/dumps/Test_wildmenu_2.dump b/src/testdir/dumps/Test_wildmenu_2.dump
new file mode 100644 (file)
index 0000000..46b41ae
--- /dev/null
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v+0#0000001#ffff4012|i|m|g|r|e|p| +3#0000000#ffffff0@1|v|i|m|g|r|e|p|a|d@1| @43
+|:+0&&|v|i|m|g|r|e|p> @66
diff --git a/src/testdir/dumps/Test_wildmenu_3.dump b/src/testdir/dumps/Test_wildmenu_3.dump
new file mode 100644 (file)
index 0000000..4474936
--- /dev/null
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v+0#0000001#ffff4012|i|m|g|r|e|p|a|d@1| +3#0000000#ffffff0@43
+|:+0&&|v|i|m|g|r|e|p|a|d@1> @63
diff --git a/src/testdir/dumps/Test_wildmenu_4.dump b/src/testdir/dumps/Test_wildmenu_4.dump
new file mode 100644 (file)
index 0000000..3703fd5
--- /dev/null
@@ -0,0 +1,8 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|v+3#0000000&|i|m|9|s|c|r|i|p|t| @1|v|i|m|g|r|e|p| @1|v|i|m|g|r|e|p|a|d@1| @43
+|:+0&&|v|i|m> @70
index 266513ee9fb4863a85ec04b22a1382713d38f56f..6ebfa31c8679fa8448768186d2ff9846de90935a 100644 (file)
@@ -84,6 +84,34 @@ func Test_complete_wildmenu()
   call delete('Xdir1', 'd')
   set nowildmenu
 endfunc
+f
+func Test_wildmenu_screendump()
+  CheckScreendump
+
+  let lines =<< trim [SCRIPT]
+    set wildmenu hlsearch
+  [SCRIPT]
+  call writefile(lines, 'XTest_wildmenu')
+
+  let buf = RunVimInTerminal('-S XTest_wildmenu', {'rows': 8})
+  call term_sendkeys(buf, ":vim\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_1', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_2', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_3', {})
+
+  call term_sendkeys(buf, "\<Tab>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_4', {})
+  call term_sendkeys(buf, "\<Esc>")
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XTest_wildmenu')
+endfunc
+
 
 func Test_map_completion()
   CheckFeature cmdline_compl
index f9198c7e8e4e0c4095c6bd87dbfdcd4cf6a0dc49..8d20b46befb0f8f4c14c829394e6dd2784032681 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1580,
 /**/
     1579,
 /**/