vim-patch:9.0.0883: a silent mapping may cause dots on the command line (#21061)

Problem:    A silent mapping may cause dots on the command line.
Solution:   Don't show dots for completion if they are not going to be removed
            again. (closes vim/vim#11501)

698a00f55d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2022-11-15 07:23:57 +08:00 committed by GitHub
parent 4541c45081
commit 2685d27cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -215,6 +215,9 @@ The search string will not be echoed when using this mapping. Messages from
the executed command are still given though. To shut them up too, add a the executed command are still given though. To shut them up too, add a
":silent" in the executed command: > ":silent" in the executed command: >
:map <silent> ,h :exe ":silent normal /Header\r"<CR> :map <silent> ,h :exe ":silent normal /Header\r"<CR>
Note that the effect of a command might also be silenced, e.g., when the
mapping selects another entry for command line completion it won't be
displayed.
Prompts will still be given, e.g., for inputdialog(). Prompts will still be given, e.g., for inputdialog().
Using "<silent>" for an abbreviation is possible, but will cause redrawing of Using "<silent>" for an abbreviation is possible, but will cause redrawing of
the command line to fail. the command line to fail.

View File

@ -173,7 +173,9 @@ int nextwild(expand_T *xp, int type, int options, bool escape)
return FAIL; return FAIL;
} }
if (!(ui_has(kUICmdline) || ui_has(kUIWildmenu))) { // If cmd_silent is set then don't show the dots, because redrawcmd() below
// won't remove them.
if (!cmd_silent && !(ui_has(kUICmdline) || ui_has(kUIWildmenu))) {
msg_puts("..."); // show that we are busy msg_puts("..."); // show that we are busy
ui_flush(); ui_flush();
} }