summaryrefslogtreecommitdiff
path: root/src/drawline.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-09 21:28:14 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-09 21:28:14 +0100
commitdbd4316806389e3c2240b48cc6c4d209cb1665fd (patch)
tree8e2776580d7fb87522c18e640d5b09127f2d1ff1 /src/drawline.c
parent3503d7c94a6c8c2a5ca1665d648d0cb81afcc863 (diff)
downloadvim-git-dbd4316806389e3c2240b48cc6c4d209cb1665fd.tar.gz
patch 8.1.2279: computation of highlight attributes is too complicatedv8.1.2279
Problem: Computation of highlight attributes is too complicated. Solution: Simplify the attribute computation and make it more consistent. (closes #5190) Fix that 'combine' set to zero doesn't work.
Diffstat (limited to 'src/drawline.c')
-rw-r--r--src/drawline.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/drawline.c b/src/drawline.c
index ea9e4a997..5cfec8407 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1470,6 +1470,16 @@ win_line(
# endif
}
}
+# ifdef FEAT_TEXT_PROP
+ // Combine text property highlight into syntax highlight.
+ if (text_prop_type != NULL)
+ {
+ if (text_prop_combine)
+ syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr);
+ else
+ syntax_attr = text_prop_attr;
+ }
+# endif
#endif
// Decide which of the highlight attributes to use.
@@ -1479,28 +1489,16 @@ win_line(
{
char_attr = hl_combine_attr(line_attr, area_attr);
# ifdef FEAT_SYN_HL
- if (syntax_attr != 0)
- char_attr = hl_combine_attr(syntax_attr, char_attr);
+ char_attr = hl_combine_attr(syntax_attr, char_attr);
# endif
}
else if (search_attr != 0)
{
char_attr = hl_combine_attr(line_attr, search_attr);
# ifdef FEAT_SYN_HL
- if (syntax_attr != 0)
- char_attr = hl_combine_attr(syntax_attr, char_attr);
+ char_attr = hl_combine_attr(syntax_attr, char_attr);
# endif
}
-# ifdef FEAT_TEXT_PROP
- else if (text_prop_type != NULL)
- {
- char_attr = hl_combine_attr(line_attr != 0
- ? line_attr
- : syntax_attr != 0
- ? syntax_attr
- : win_attr, text_prop_attr);
- }
-# endif
else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
|| vcol < fromcol || vcol_prev < fromcol_prev
|| vcol >= tocol))
@@ -1508,11 +1506,10 @@ win_line(
// Use line_attr when not in the Visual or 'incsearch' area
// (area_attr may be 0 when "noinvcur" is set).
# ifdef FEAT_SYN_HL
- if (syntax_attr != 0)
- char_attr = hl_combine_attr(syntax_attr, line_attr);
- else
+ char_attr = hl_combine_attr(syntax_attr, line_attr);
+# else
+ char_attr = line_attr;
# endif
- char_attr = line_attr;
attr_pri = FALSE;
}
#else
@@ -1524,22 +1521,10 @@ win_line(
else
{
attr_pri = FALSE;
-#ifdef FEAT_TEXT_PROP
- if (text_prop_type != NULL)
- {
- if (text_prop_combine)
- char_attr = hl_combine_attr(
- syntax_attr, text_prop_attr);
- else
- char_attr = hl_combine_attr(
- win_attr, text_prop_attr);
- }
- else
-#endif
#ifdef FEAT_SYN_HL
- char_attr = syntax_attr;
+ char_attr = syntax_attr;
#else
- char_attr = 0;
+ char_attr = 0;
#endif
}
}