patch 9.1.1771: complete: some redraw issues with 'autocomplete'

Commit: 
https://github.com/vim/vim/commit/ee9a2f0512e8b732e3c6a000974aa7e3f6028989
Author: Girish Palya <[email protected]>
Date:   Thu Sep 18 19:46:01 2025 +0000

    patch 9.1.1771: complete: some redraw issues with 'autocomplete'
    
    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index f917dccf2..0df08dd71 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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);
diff --git a/src/insexpand.c b/src/insexpand.c
index c97f5b279..d98b5c1b0 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -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
index 000000000..bd0a8141c
--- /dev/null
+++ b/src/testdir/dumps/Test_update_screen_wildtrigger_1.dump
@@ -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
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 22e2c00a3..bdba4abff 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -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
diff --git a/src/testdir/test_ins_complete.vim 
b/src/testdir/test_ins_complete.vim
index 32a89836c..2bd726b7d 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index bd78cbf1d..c98d6ccc6 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 */
+/**/
+    1771,
 /**/
     1770,
 /**/

-- 
-- 
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/E1uzKnV-00Emsn-AJ%40256bit.org.

Raspunde prin e-mail lui