aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawline.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:15:05 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-25 19:27:38 +0000
commitc5d770d311841ea5230426cc4c868e8db27300a8 (patch)
treedd21f70127b4b8b5f109baefc8ecc5016f507c91 /src/nvim/drawline.c
parent9be89f131f87608f224f0ee06d199fcd09d32176 (diff)
parent081beb3659bd6d8efc3e977a160b1e72becbd8a2 (diff)
downloadrneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.gz
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.tar.bz2
rneovim-c5d770d311841ea5230426cc4c868e8db27300a8.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/drawline.c')
-rw-r--r--src/nvim/drawline.c50
1 files changed, 13 insertions, 37 deletions
diff --git a/src/nvim/drawline.c b/src/nvim/drawline.c
index 3b88dd2e90..79f3298eb4 100644
--- a/src/nvim/drawline.c
+++ b/src/nvim/drawline.c
@@ -927,7 +927,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
bool noinvcur = false; // don't invert the cursor
bool lnum_in_visual_area = false;
- bool attr_pri = false; // char_attr has priority
+ int char_attr_pri = 0; // attributes with high priority
+ int char_attr_base = 0; // attributes with low priority
bool area_highlighting = false; // Visual or incsearch highlighting in this line
int vi_attr = 0; // attributes for Visual and incsearch highlighting
int area_attr = 0; // attributes desired by highlighting
@@ -1741,16 +1742,14 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
}
// Decide which of the highlight attributes to use.
- attr_pri = true;
-
if (area_attr != 0) {
- wlv.char_attr = hl_combine_attr(wlv.line_attr, area_attr);
+ char_attr_pri = hl_combine_attr(wlv.line_attr, area_attr);
if (!highlight_match) {
// let search highlight show in Visual area if possible
- wlv.char_attr = hl_combine_attr(search_attr, wlv.char_attr);
+ char_attr_pri = hl_combine_attr(search_attr, char_attr_pri);
}
} else if (search_attr != 0) {
- wlv.char_attr = hl_combine_attr(wlv.line_attr, search_attr);
+ char_attr_pri = hl_combine_attr(wlv.line_attr, search_attr);
} else if (wlv.line_attr != 0
&& ((wlv.fromcol == -10 && wlv.tocol == MAXCOL)
|| wlv.vcol < wlv.fromcol
@@ -1758,15 +1757,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|| wlv.vcol >= wlv.tocol)) {
// Use wlv.line_attr when not in the Visual or 'incsearch' area
// (area_attr may be 0 when "noinvcur" is set).
- wlv.char_attr = wlv.line_attr;
+ char_attr_pri = wlv.line_attr;
} else {
- attr_pri = false;
- wlv.char_attr = decor_attr;
- }
-
- if (folded_attr != 0) {
- wlv.char_attr = hl_combine_attr(folded_attr, wlv.char_attr);
+ char_attr_pri = 0;
}
+ char_attr_base = hl_combine_attr(folded_attr, decor_attr);
+ wlv.char_attr = hl_combine_attr(char_attr_base, char_attr_pri);
}
if (draw_folded && has_foldtext && wlv.n_extra == 0 && wlv.col == win_col_offset) {
@@ -1997,25 +1993,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
can_spell = TRISTATE_TO_BOOL(decor_state.spell, can_spell);
}
- if (folded_attr) {
- decor_attr = hl_combine_attr(folded_attr, decor_attr);
- }
-
- if (decor_attr) {
- if (!attr_pri) {
- if (wlv.cul_attr) {
- wlv.char_attr = 0 != wlv.line_attr_lowprio
- ? hl_combine_attr(wlv.cul_attr, decor_attr)
- : hl_combine_attr(decor_attr, wlv.cul_attr);
- } else {
- wlv.char_attr = decor_attr;
- }
- } else {
- wlv.char_attr = hl_combine_attr(decor_attr, wlv.char_attr);
- }
- } else if (!attr_pri) {
- wlv.char_attr = 0;
- }
+ char_attr_base = hl_combine_attr(folded_attr, decor_attr);
+ wlv.char_attr = hl_combine_attr(char_attr_base, char_attr_pri);
// Check spelling (unless at the end of the line).
// Only do this when there is no syntax highlighting, the
@@ -2083,11 +2062,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
}
}
if (spell_attr != 0) {
- if (!attr_pri) {
- wlv.char_attr = hl_combine_attr(wlv.char_attr, spell_attr);
- } else {
- wlv.char_attr = hl_combine_attr(spell_attr, wlv.char_attr);
- }
+ char_attr_base = hl_combine_attr(char_attr_base, spell_attr);
+ wlv.char_attr = hl_combine_attr(char_attr_base, char_attr_pri);
}
if (wp->w_buffer->terminal) {