commit 2de284e50b6dbe6d854caa5b28db3a300ee10532
parent dec3c6fa346b298e7feb72398f9fdd5d59c11444
Author: luukvbaal <luukvbaal@gmail.com>
Date: Thu, 19 Feb 2026 22:01:43 +0100
fix(message): set replace_last for completion "scanning" messages #37967
Problem: UIs put ins-completion "scanning" messages one after another,
which are meant to overwrite the previous message.
Solution: Ensure the msg_show "replace_last" parameter is set.
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
@@ -3776,6 +3776,7 @@ static int process_next_cpt_value(ins_compl_next_state_T *st, int *compl_type_ar
}
if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete) {
msg_hist_off = true; // reset in msg_trunc()
+ msg_ext_overwrite = true;
msg_ext_set_kind("completion");
vim_snprintf(IObuff, IOSIZE, _("Scanning: %s"),
st->ins_buf->b_fname == NULL
@@ -3818,6 +3819,7 @@ static int process_next_cpt_value(ins_compl_next_state_T *st, int *compl_type_ar
if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete) {
msg_ext_set_kind("completion");
msg_hist_off = true; // reset in msg_trunc()
+ msg_ext_overwrite = true;
vim_snprintf(IObuff, IOSIZE, "%s", _("Scanning tags."));
msg_trunc(IObuff, true, HLF_R);
}
diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua
@@ -1615,6 +1615,27 @@ stack traceback:
},
})
end)
+
+ it('completion message overwrites previous', function()
+ command('set shortmess-=C | edit foo | edit bar | edit baz')
+ feed('i<C-N>')
+ screen:expect({
+ grid = [[
+ ^ |
+ {1:~ }|*4
+ ]],
+ messages = {
+ {
+ content = { { 'Scanning tags.', 6, 'Question' } },
+ kind = 'completion',
+ },
+ },
+ showmode = {
+ { '-- Keyword completion (^N^P) ', 5, 'ModeMsg' },
+ { 'Pattern not found', 9, 'ErrorMsg' },
+ },
+ })
+ end)
end)
describe('ui/builtin messages', function()