aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthieu Coudron <teto@users.noreply.github.com>2020-12-29 01:19:24 +0100
committerGitHub <noreply@github.com>2020-12-29 01:19:24 +0100
commitb0215afc84102073554bb7cf990b881b33878ac1 (patch)
treebe606cf2a0f108bc1bac2dbd3c9133d6ede7486c /src
parent93762072d13477f1847ddd918840323e4e1322dc (diff)
downloadrneovim-b0215afc84102073554bb7cf990b881b33878ac1.tar.gz
rneovim-b0215afc84102073554bb7cf990b881b33878ac1.tar.bz2
rneovim-b0215afc84102073554bb7cf990b881b33878ac1.zip
fix(fold): dont highlight search results on folded lines (#13616)
Behavior may change in future but for now stick to legacy behavior.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/screen.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 07c959b257..8f78b5fc15 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2013,6 +2013,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
// end-of-line
int lcs_eol_one = wp->w_p_lcs_chars.eol; // 'eol' until it's been used
int lcs_prec_todo = wp->w_p_lcs_chars.prec; // 'prec' until it's been used
+ bool has_fold = foldinfo.fi_level != 0 && foldinfo.fi_lines >= 0;
// saved "extra" items for when draw_state becomes WL_LINE (again)
int saved_n_extra = 0;
@@ -2196,7 +2197,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
}
if (wp->w_p_spell
- && foldinfo.fi_lines == 0
+ && !has_fold
&& *wp->w_s->b_p_spl != NUL
&& !GA_EMPTY(&wp->w_s->b_langp)
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
@@ -2299,6 +2300,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
// handle 'incsearch' and ":s///c" highlighting
} else if (highlight_match
&& wp == curwin
+ && !has_fold
&& lnum >= curwin->w_cursor.lnum
&& lnum <= curwin->w_cursor.lnum + search_match_lines) {
if (lnum == curwin->w_cursor.lnum) {
@@ -2551,7 +2553,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
cur = wp->w_match_head;
shl_flag = false;
while ((cur != NULL || !shl_flag) && !number_only
- && foldinfo.fi_lines == 0
+ && !has_fold
) {
if (!shl_flag) {
shl = &search_hl;