vim-patch:8.2.4336: using :filter for :scriptnames does not work

Problem:    Using :filter for :scriptnames does not work. (Ben Jackson)
Solution:   Call message_filtered(). (closes vim/vim#9720)
769f5895eb

Cherry-pick a modeline from Vim patch 8.2.1432.
This commit is contained in:
zeertzjq
2022-02-10 07:28:54 +08:00
parent aea889fc06
commit c415e764d4
2 changed files with 14 additions and 3 deletions

View File

@@ -12,6 +12,7 @@
#include <string.h> #include <string.h>
#include "nvim/ascii.h" #include "nvim/ascii.h"
#include "nvim/globals.h"
#include "nvim/vim.h" #include "nvim/vim.h"
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
# include <locale.h> # include <locale.h>
@@ -2190,11 +2191,13 @@ void ex_scriptnames(exarg_T *eap)
if (SCRIPT_ITEM(i).sn_name != NULL) { if (SCRIPT_ITEM(i).sn_name != NULL) {
home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, true); home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, true);
vim_snprintf((char *)IObuff, IOSIZE, "%3d: %s", i, NameBuff); vim_snprintf((char *)IObuff, IOSIZE, "%3d: %s", i, NameBuff);
if (!message_filtered(IObuff)) {
msg_putchar('\n'); msg_putchar('\n');
msg_outtrans(IObuff); msg_outtrans(IObuff);
line_breakcheck(); line_breakcheck();
} }
} }
}
} }
#if defined(BACKSLASH_IN_FILENAME) #if defined(BACKSLASH_IN_FILENAME)

View File

@@ -172,3 +172,11 @@ func Test_filter_display()
bwipe! bwipe!
endfunc endfunc
func Test_filter_scriptnames()
let lines = split(execute('filter /test_filter_cmd/ scriptnames'), "\n")
call assert_equal(1, len(lines))
call assert_match('filter_cmd', lines[0])
endfunc
" vim: shiftwidth=2 sts=2 expandtab