aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/message.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-04-30 09:46:41 -0400
committerGitHub <noreply@github.com>2017-04-30 09:46:41 -0400
commit5d73a6e5dfbd1a7ce27888e7a7ac1c402da9dfc8 (patch)
tree7652a59b6b7b7305f5b43a3ddb95c9a348cb377d /src/nvim/message.c
parent4afc93b926dc14365db4bad4cd4030d5d5a69747 (diff)
parent35d817e68c9d1f2fd724bf00ad6f1958a0c815a9 (diff)
downloadrneovim-5d73a6e5dfbd1a7ce27888e7a7ac1c402da9dfc8.tar.gz
rneovim-5d73a6e5dfbd1a7ce27888e7a7ac1c402da9dfc8.tar.bz2
rneovim-5d73a6e5dfbd1a7ce27888e7a7ac1c402da9dfc8.zip
Merge pull request #6621 from jamessan/vim-7.4.2231
vim-patch:7.4.2231,7.4.2239,7.4.2244,7.4.2245,7.4.2246,7.4.2263,8.0.0150
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r--src/nvim/message.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 696855e3aa..057ce75f79 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,18 @@ 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)
+{
+ if (cmdmod.filter_regmatch.regprog == NULL) {
+ return false;
+ }
+
+ bool match = vim_regexec(&cmdmod.filter_regmatch, msg, (colnr_T)0);
+ return cmdmod.filter_force ? match : !match;
+}
+
/*
* Scroll the screen up one line for displaying the next message line.
*/