]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1771: complete: some redraw issues with 'autocomplete' v9.1.1771
authorGirish Palya <girishji@gmail.com>
Thu, 18 Sep 2025 19:46:01 +0000 (19:46 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 18 Sep 2025 19:46:01 +0000 (19:46 +0000)
Problem:  complete: some redraw issues with 'autocomplete'
Solution: Fix the issues (Girish Palya)

This commit contains the following changes:
* Fix that wildtrigger() might leave opened popupmenu around #18298
* Remove blinking message on the command line when a menu item from a loaded
  buffer is selected during 'autocomplete'
* Add a test for PR #18265 to demonstrate why the PR is required for correct
  'autocomplete' behavior

fixes: #18298
closes: #18328

Signed-off-by: Girish Palya <girishji@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_getln.c
src/insexpand.c
src/testdir/dumps/Test_update_screen_wildtrigger_1.dump [new file with mode: 0644]
src/testdir/test_cmdline.vim
src/testdir/test_ins_complete.vim
src/version.c

index f917dccf2271913e14b578e853b3df1fce35721f..0df08dd718f35a995bd81b1a1c60186349bf284c 100644 (file)
@@ -2037,6 +2037,7 @@ getcmdline_int(
            if (cmdline_pum_active())
            {
                skip_pum_redraw = skip_pum_redraw && !key_is_wc
+                   && !VIM_ISWHITE(c)
                    && (vim_isprintc(c)
                        || c == K_BS || c == Ctrl_H || c == K_DEL
                        || c == K_KDEL || c == Ctrl_W || c == Ctrl_U);
index c97f5b279689cb5ab52109d27f8880fdec7346be..d98b5c1b0d9d1731055eccee1243bb4293691f1c 100644 (file)
@@ -6007,12 +6007,15 @@ ins_compl_show_filename(void)
            MB_PTR_ADV(s);
        }
     }
-    msg_hist_off = TRUE;
-    vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
-           s > compl_shown_match->cp_fname ? "<" : "", s);
-    msg((char *)IObuff);
-    msg_hist_off = FALSE;
-    redraw_cmdline = FALSE;        // don't overwrite!
+    if (!compl_autocomplete)
+    {
+       msg_hist_off = TRUE;
+       vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
+               s > compl_shown_match->cp_fname ? "<" : "", s);
+       msg((char *)IObuff);
+       msg_hist_off = FALSE;
+       redraw_cmdline = FALSE;     // don't overwrite!
+    }
 }
 
 /*
diff --git a/src/testdir/dumps/Test_update_screen_wildtrigger_1.dump b/src/testdir/dumps/Test_update_screen_wildtrigger_1.dump
new file mode 100644 (file)
index 0000000..bd0a814
--- /dev/null
@@ -0,0 +1,10 @@
+| +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|:+0#0000000&|t|e|r|m| |f|o@1> @65
index 22e2c00a370bbd1a1bb4910736395d7f87ef3c7b..bdba4abff1227e689b1718ea2f27a243433b874d 100644 (file)
@@ -5088,4 +5088,23 @@ func Test_skip_wildtrigger_hist_navigation()
   cunmap <Down>
 endfunc
 
+" Issue 18298: wildmenu should be dismissed after wildtrigger and whitespace
+func Test_update_screen_after_wildtrigger()
+  CheckScreendump
+  let lines =<< trim [SCRIPT]
+    call test_override("char_avail", 1)
+    set wildmode=noselect:lastused,full wildmenu wildoptions=pum
+    autocmd CmdlineChanged : if getcmdcompltype() != 'shellcmd' | call wildtrigger() | endif
+  [SCRIPT]
+  call writefile(lines, 'XTest_wildtrigger', 'D')
+  let buf = RunVimInTerminal('-S XTest_wildtrigger', {'rows': 10})
+
+  call term_sendkeys(buf, ":term foo")
+  call TermWait(buf, 50)
+  call VerifyScreenDump(buf, 'Test_update_screen_wildtrigger_1', {})
+
+  call term_sendkeys(buf, "\<esc>")
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 32a89836ca85757e86e168852823f9b5804cd4e7..2bd726b7dff64fbc6cbc81f015a609c47e241ba3 100644 (file)
@@ -5247,7 +5247,7 @@ func Test_autocomplete_trigger()
   call feedkeys("Sazx\<Left>\<BS>\<F2>\<Esc>0", 'tx!')
   call assert_equal(['and', 'afoo'], b:matches->mapnew('v:val.word'))
 
-  " Test 6: <BS> should clear the selected item
+  " Test 6: <BS> should clear the selected item (PR #18265)
   %d
   call setline(1, ["foobarfoo", "foobar", "foobarbaz"])
   call feedkeys("Gofo\<C-N>\<C-N>\<F2>\<F3>\<Esc>0", 'tx!')
@@ -5262,6 +5262,13 @@ func Test_autocomplete_trigger()
   call assert_equal(0, b:selected)
   call assert_equal('foobarbaz', getline(4))
 
+  " Test 7: Remove selection when menu contents change (PR #18265)
+  %d
+  call setline(1, ["foobar", "fodxyz", "fodabc"])
+  call feedkeys("Gofoo\<C-N>\<BS>\<BS>\<BS>\<BS>d\<F2>\<F3>\<Esc>0", 'tx!')
+  call assert_equal(['fodabc', 'fodxyz'], b:matches->mapnew('v:val.word'))
+  call assert_equal(-1, b:selected)
+
   bw!
   call test_override("char_avail", 0)
   delfunc NonKeywordComplete
index bd78cbf1d5fadb17d313dd51ead3d1c85f82e57c..c98d6ccc605251da30ef7a66754787a3ae352a15 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1771,
 /**/
     1770,
 /**/