diff options
author | James McCoy <jamessan@jamessan.com> | 2017-04-29 07:58:49 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-04-29 23:48:27 -0400 |
commit | 7bd97127b4e45dcef1159603834b04ef0dcadfd7 (patch) | |
tree | 650f557edef609d8fa5c764503f0da880e55a07d /src/nvim/message.c | |
parent | 059c3fc2f952b42824ca37610c040c938a75de5c (diff) | |
download | rneovim-7bd97127b4e45dcef1159603834b04ef0dcadfd7.tar.gz rneovim-7bd97127b4e45dcef1159603834b04ef0dcadfd7.tar.bz2 rneovim-7bd97127b4e45dcef1159603834b04ef0dcadfd7.zip |
vim-patch:7.4.2244
Problem: Adding pattern to ":oldfiles" is not a generic solution.
Solution: Add the ":filter /pat/ cmd" command modifier. Only works for some
commands right now.
https://github.com/vim/vim/commit/7b668e83d0635d082b7ec90d7d2aa30a9d7d8928
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 696855e3aa..c83dfcd63f 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -31,6 +31,7 @@ #include "nvim/ops.h" #include "nvim/option.h" #include "nvim/normal.h" +#include "nvim/regexp.h" #include "nvim/screen.h" #include "nvim/strings.h" #include "nvim/ui.h" @@ -148,6 +149,12 @@ msg_attr_keep ( int retval; char_u *buf = NULL; + // Skip messages not match ":filter pattern". + // Don't filter when there is an error. + if (!emsg_on_display && message_filtered(s)) { + return true; + } + if (attr == 0) { set_vim_var_string(VV_STATUSMSG, (char *) s, -1); } @@ -1783,6 +1790,14 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, msg_check(); } +/// Return true when ":filter pattern" was used and "msg" does not match +/// "pattern". +bool message_filtered(char_u *msg) +{ + return cmdmod.filter_regmatch.regprog != NULL + && !vim_regexec(&cmdmod.filter_regmatch, msg, (colnr_T)0); +} + /* * Scroll the screen up one line for displaying the next message line. */ |