mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
Merge pull request #23742 from bfredl/neolight
fix(drawline): combine extmark highlight with area hl correctly
This commit is contained in:
@@ -1073,7 +1073,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
int saved_search_attr = 0; // search_attr to be used when n_extra
|
||||
// goes to zero
|
||||
int vcol_save_attr = 0; // saved attr for 'cursorcolumn'
|
||||
int syntax_attr = 0; // attributes desired by syntax
|
||||
int decor_attr = 0; // attributes desired by syntax and extmarks
|
||||
bool has_syntax = false; // this buffer has syntax highl.
|
||||
int folded_attr = 0; // attributes for folded line
|
||||
int save_did_emsg;
|
||||
@@ -1909,11 +1909,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
wlv.char_attr = wlv.line_attr;
|
||||
} else {
|
||||
attr_pri = false;
|
||||
if (has_syntax) {
|
||||
wlv.char_attr = syntax_attr;
|
||||
} else {
|
||||
wlv.char_attr = 0;
|
||||
}
|
||||
wlv.char_attr = decor_attr;
|
||||
}
|
||||
|
||||
if (folded_attr != 0) {
|
||||
@@ -2116,11 +2112,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
}
|
||||
ptr++;
|
||||
|
||||
decor_attr = 0;
|
||||
if (extra_check) {
|
||||
bool no_plain_buffer = (wp->w_s->b_p_spo_flags & SPO_NPBUFFER) != 0;
|
||||
bool can_spell = !no_plain_buffer;
|
||||
|
||||
// Get syntax attribute, unless still at the start of the line
|
||||
// Get extmark and syntax attributes, unless still at the start of the line
|
||||
// (double-wide char that doesn't fit).
|
||||
v = (ptr - line);
|
||||
if (has_syntax && v > 0) {
|
||||
@@ -2129,8 +2126,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
save_did_emsg = did_emsg;
|
||||
did_emsg = false;
|
||||
|
||||
syntax_attr = get_syntax_attr((colnr_T)v - 1,
|
||||
has_spell ? &can_spell : NULL, false);
|
||||
decor_attr = get_syntax_attr((colnr_T)v - 1,
|
||||
has_spell ? &can_spell : NULL, false);
|
||||
|
||||
if (did_emsg) { // -V547
|
||||
wp->w_s->b_syn_error = true;
|
||||
@@ -2148,17 +2145,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
line = ml_get_buf(wp->w_buffer, lnum, false);
|
||||
ptr = line + v;
|
||||
|
||||
if (!attr_pri) {
|
||||
if (wlv.cul_attr) {
|
||||
wlv.char_attr = 0 != wlv.line_attr_lowprio
|
||||
? hl_combine_attr(wlv.cul_attr, syntax_attr)
|
||||
: hl_combine_attr(syntax_attr, wlv.cul_attr);
|
||||
} else {
|
||||
wlv.char_attr = syntax_attr;
|
||||
}
|
||||
} else {
|
||||
wlv.char_attr = hl_combine_attr(syntax_attr, wlv.char_attr);
|
||||
}
|
||||
// no concealing past the end of the line, it interferes
|
||||
// with line highlighting.
|
||||
if (c == NUL) {
|
||||
@@ -2166,27 +2152,35 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
} else {
|
||||
syntax_flags = get_syntax_info(&syntax_seqnr);
|
||||
}
|
||||
} else if (!attr_pri) {
|
||||
wlv.char_attr = 0;
|
||||
}
|
||||
|
||||
if (has_decor && v > 0) {
|
||||
if (extmark_attr != 0) {
|
||||
if (!attr_pri) {
|
||||
wlv.char_attr = hl_combine_attr(wlv.char_attr, extmark_attr);
|
||||
} else {
|
||||
wlv.char_attr = hl_combine_attr(extmark_attr, wlv.char_attr);
|
||||
}
|
||||
}
|
||||
// extmarks take preceedence over syntax.c
|
||||
decor_attr = hl_combine_attr(decor_attr, extmark_attr);
|
||||
|
||||
decor_conceal = decor_state.conceal;
|
||||
if (decor_conceal && decor_state.conceal_char) {
|
||||
decor_conceal = 2; // really??
|
||||
}
|
||||
|
||||
can_spell = TRISTATE_TO_BOOL(decor_state.spell, can_spell);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// Check spelling (unless at the end of the line).
|
||||
// Only do this when there is no syntax highlighting, the
|
||||
// @Spell cluster is not used or the current syntax item
|
||||
@@ -2197,8 +2191,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int mod_top, bo
|
||||
char *prev_ptr = ptr - mb_l;
|
||||
// do not calculate cap_col at the end of the line or when
|
||||
// only white space is following
|
||||
if (c != 0 && (*skipwhite(prev_ptr) != NUL)
|
||||
&& ((!has_syntax && !no_plain_buffer) || can_spell)) {
|
||||
if (c != 0 && (*skipwhite(prev_ptr) != NUL) && can_spell) {
|
||||
char *p;
|
||||
hlf_T spell_hlf = HLF_COUNT;
|
||||
v -= mb_l - 1;
|
||||
|
Reference in New Issue
Block a user