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.

7b668e83d0
This commit is contained in:
James McCoy
2017-04-29 07:58:49 -04:00
parent 059c3fc2f9
commit 7bd97127b4
8 changed files with 105 additions and 30 deletions

View File

@@ -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.
*/