summaryrefslogtreecommitdiff
path: root/src/message.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-23 23:51:21 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-23 23:51:21 +0200
commit7b668e83d0635d082b7ec90d7d2aa30a9d7d8928 (patch)
tree5a766b46ad4395652cfe4d2545ee809047384fc9 /src/message.c
parent1b58cdd160c2e0ada0f638679a2aa27e4665fc48 (diff)
downloadvim-git-7b668e83d0635d082b7ec90d7d2aa30a9d7d8928.tar.gz
patch 7.4.2244v7.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.
Diffstat (limited to 'src/message.c')
-rw-r--r--src/message.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/message.c b/src/message.c
index a7398f6eb..f24bc2817 100644
--- a/src/message.c
+++ b/src/message.c
@@ -137,6 +137,11 @@ msg_attr_keep(
int retval;
char_u *buf = NULL;
+ /* Skip messages not matching ":filter pattern".
+ * Don't filter when there is an error. */
+ if (!emsg_on_display && message_filtered(s))
+ return TRUE;
+
#ifdef FEAT_EVAL
if (attr == 0)
set_vim_var_string(VV_STATUSMSG, s, -1);
@@ -2150,6 +2155,17 @@ msg_puts_display(
}
/*
+ * Return TRUE when ":filter pattern" was used and "msg" does not match
+ * "pattern".
+ */
+ int
+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.
*/
static void