screen.c: fix last character on foldtext

Last character on a folded line was sometimes highlighted with the
"Search" highlight. Solves this along with some remaining "curwin".
This commit is contained in:
Matthieu Coudron 2021-01-06 20:39:14 +01:00
parent 2ea3127697
commit b419e39a2a

View File

@ -2417,8 +2417,8 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
} }
} }
if (wp->w_p_list) { if (wp->w_p_list && !has_fold) {
if (curwin->w_p_lcs_chars.space if (wp->w_p_lcs_chars.space
|| wp->w_p_lcs_chars.trail || wp->w_p_lcs_chars.trail
|| wp->w_p_lcs_chars.nbsp) { || wp->w_p_lcs_chars.nbsp) {
extra_check = true; extra_check = true;
@ -2883,8 +2883,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
} }
if (draw_state == WL_LINE if (draw_state == WL_LINE
&& foldinfo.fi_level != 0 && has_fold
&& foldinfo.fi_lines > 0
&& vcol == 0 && vcol == 0
&& n_extra == 0 && n_extra == 0
&& row == startrow) { && row == startrow) {
@ -2905,8 +2904,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
} }
if (draw_state == WL_LINE if (draw_state == WL_LINE
&& foldinfo.fi_level != 0 && has_fold
&& foldinfo.fi_lines > 0
&& col < grid->Columns && col < grid->Columns
&& n_extra == 0 && n_extra == 0
&& row == startrow) { && row == startrow) {
@ -2918,8 +2916,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
} }
if (draw_state == WL_LINE if (draw_state == WL_LINE
&& foldinfo.fi_level != 0 && has_fold
&& foldinfo.fi_lines > 0
&& col >= grid->Columns && col >= grid->Columns
&& n_extra != 0 && n_extra != 0
&& row == startrow) { && row == startrow) {
@ -3087,7 +3084,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
|| vcol < fromcol || vcol_prev < fromcol_prev || vcol < fromcol || vcol_prev < fromcol_prev
|| vcol >= tocol)) { || vcol >= tocol)) {
char_attr = line_attr; char_attr = line_attr;
} else { } else {
attr_pri = false; attr_pri = false;
if (has_syntax) { if (has_syntax) {
char_attr = syntax_attr; char_attr = syntax_attr;
@ -3742,7 +3739,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
} }
wp->w_wrow = row; wp->w_wrow = row;
did_wcol = true; did_wcol = true;
curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL; wp->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
} }
// Don't override visual selection highlighting. // Don't override visual selection highlighting.
@ -3835,9 +3832,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
// Add a blank character to highlight. // Add a blank character to highlight.
schar_from_ascii(linebuf_char[off], ' '); schar_from_ascii(linebuf_char[off], ' ');
} }
if (area_attr == 0) { if (area_attr == 0 && !has_fold) {
/* Use attributes from match with highest priority among // Use attributes from match with highest priority among
* 'search_hl' and the match list. */ // 'search_hl' and the match list.
char_attr = search_hl.attr; char_attr = search_hl.attr;
cur = wp->w_match_head; cur = wp->w_match_head;
shl_flag = FALSE; shl_flag = FALSE;