aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_getln.c21
-rw-r--r--src/nvim/version.c2
2 files changed, 22 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2178505874..a2f8994403 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1781,6 +1781,20 @@ static int command_line_not_changed(CommandLineState *s)
return command_line_changed(s);
}
+/// Guess that the pattern matches everything. Only finds specific cases, such
+/// as a trailing \|, which can happen while typing a pattern.
+static int empty_pattern(char_u *p)
+{
+ int n = STRLEN(p);
+
+ // remove trailing \v and the like
+ while (n >= 2 && p[n - 2] == '\\'
+ && vim_strchr((char_u *)"mMvVcCZ", p[n - 1]) != NULL) {
+ n -= 2;
+ }
+ return n == 0 || (n >= 2 && p[n - 2] == '\\' && p[n - 1] == '|');
+}
+
static int command_line_changed(CommandLineState *s)
{
// 'incsearch' highlighting.
@@ -1856,6 +1870,13 @@ static int command_line_changed(CommandLineState *s)
end_pos = curwin->w_cursor; // shutup gcc 4
}
+
+ // Disable 'hlsearch' highlighting if the pattern matches8.0.1304
+ // everything. Avoids a flash when typing "foo\|".
+ if (empty_pattern(ccline.cmdbuff)) {
+ SET_NO_HLSEARCH(true);
+ }
+
validate_cursor();
// May redraw the status line to show the cursor position.
if (p_ru && curwin->w_status_height > 0) {
diff --git a/src/nvim/version.c b/src/nvim/version.c
index ba2912ef29..e627022ea6 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -104,7 +104,7 @@ static const int included_patches[] = {
1396,
// 1395,
// 1394,
- // 1393,
+ 1393,
// 1392,
// 1391,
// 1390,