Mercurial > vim
comparison src/drawline.c @ 29736:65348cc3b656 v9.0.0208
patch 9.0.0208: the override flag has no effect for virtual text
Commit: https://github.com/vim/vim/commit/9e7e28fc4c32337f2153b94fb08140f47e46e35d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 14 16:36:38 2022 +0100
patch 9.0.0208: the override flag has no effect for virtual text
Problem: The override flag has no effect for virtual text. (Ben Jackson)
Solution: Make the override flag work. (closes https://github.com/vim/vim/issues/10915)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Aug 2022 17:45:03 +0200 |
parents | f88671dbe88b |
children | 4092d04cd46f |
comparison
equal
deleted
inserted
replaced
29735:1aa33a99c854 | 29736:65348cc3b656 |
---|---|
552 int text_prop_next = 0; // next text property to use | 552 int text_prop_next = 0; // next text property to use |
553 textprop_T *text_props = NULL; | 553 textprop_T *text_props = NULL; |
554 int *text_prop_idxs = NULL; | 554 int *text_prop_idxs = NULL; |
555 int text_props_active = 0; | 555 int text_props_active = 0; |
556 proptype_T *text_prop_type = NULL; | 556 proptype_T *text_prop_type = NULL; |
557 int extra_for_textprop = FALSE; // wlv.n_extra set for textprop | |
557 int text_prop_attr = 0; | 558 int text_prop_attr = 0; |
558 int text_prop_id = 0; // active property ID | 559 int text_prop_id = 0; // active property ID |
559 int text_prop_flags = 0; | 560 int text_prop_flags = 0; |
560 int text_prop_follows = FALSE; // another text prop to display | 561 int text_prop_follows = FALSE; // another text prop to display |
561 int saved_search_attr = 0; // search_attr to be used when n_extra | 562 int saved_search_attr = 0; // search_attr to be used when n_extra |
1643 + text_props[text_prop_next].tp_len) | 1644 + text_props[text_prop_next].tp_len) |
1644 text_prop_idxs[text_props_active++] = text_prop_next; | 1645 text_prop_idxs[text_props_active++] = text_prop_next; |
1645 ++text_prop_next; | 1646 ++text_prop_next; |
1646 } | 1647 } |
1647 | 1648 |
1648 text_prop_attr = 0; | 1649 if (wlv.n_extra == 0 || !extra_for_textprop) |
1649 text_prop_flags = 0; | 1650 { |
1650 text_prop_type = NULL; | 1651 text_prop_attr = 0; |
1651 text_prop_id = 0; | 1652 text_prop_flags = 0; |
1653 text_prop_type = NULL; | |
1654 text_prop_id = 0; | |
1655 } | |
1652 if (text_props_active > 0 && wlv.n_extra == 0) | 1656 if (text_props_active > 0 && wlv.n_extra == 0) |
1653 { | 1657 { |
1654 int used_tpi = -1; | 1658 int used_tpi = -1; |
1655 int used_attr = 0; | 1659 int used_attr = 0; |
1656 int other_tpi = -1; | 1660 int other_tpi = -1; |
1707 | 1711 |
1708 wlv.p_extra = p; | 1712 wlv.p_extra = p; |
1709 wlv.c_extra = NUL; | 1713 wlv.c_extra = NUL; |
1710 wlv.c_final = NUL; | 1714 wlv.c_final = NUL; |
1711 wlv.n_extra = (int)STRLEN(p); | 1715 wlv.n_extra = (int)STRLEN(p); |
1716 extra_for_textprop = TRUE; | |
1712 extra_attr = used_attr; | 1717 extra_attr = used_attr; |
1713 n_attr = mb_charlen(p); | 1718 n_attr = mb_charlen(p); |
1714 saved_search_attr = search_attr; | 1719 saved_search_attr = search_attr; |
1715 search_attr = 0; // restore when n_extra is zero | 1720 search_attr = 0; // restore when n_extra is zero |
1716 text_prop_attr = 0; | 1721 text_prop_attr = 0; |
2092 } | 2097 } |
2093 --wlv.n_extra; | 2098 --wlv.n_extra; |
2094 #if defined(FEAT_PROP_POPUP) | 2099 #if defined(FEAT_PROP_POPUP) |
2095 if (wlv.n_extra <= 0) | 2100 if (wlv.n_extra <= 0) |
2096 { | 2101 { |
2102 extra_for_textprop = FALSE; | |
2097 in_linebreak = FALSE; | 2103 in_linebreak = FALSE; |
2098 if (search_attr == 0) | 2104 if (search_attr == 0) |
2099 search_attr = saved_search_attr; | 2105 search_attr = saved_search_attr; |
2100 } | 2106 } |
2101 #endif | 2107 #endif |
2980 curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED); | 2986 curwin->w_flags &= ~(WFLAG_WCOL_OFF_ADDED | WFLAG_WROW_OFF_ADDED); |
2981 # endif | 2987 # endif |
2982 } | 2988 } |
2983 #endif | 2989 #endif |
2984 | 2990 |
2985 // Use "extra_attr", but don't override visual selection highlighting. | 2991 // Use "extra_attr", but don't override visual selection highlighting, |
2992 // unless text property overrides. | |
2986 // Don't use "extra_attr" until n_attr_skip is zero. | 2993 // Don't use "extra_attr" until n_attr_skip is zero. |
2987 if (n_attr_skip == 0 && n_attr > 0 | 2994 if (n_attr_skip == 0 && n_attr > 0 |
2988 && wlv.draw_state == WL_LINE | 2995 && wlv.draw_state == WL_LINE |
2989 && !attr_pri) | 2996 && (!attr_pri || (text_prop_flags & PT_FLAG_OVERRIDE))) |
2990 { | 2997 { |
2991 #ifdef LINE_ATTR | 2998 #ifdef LINE_ATTR |
2992 if (line_attr) | 2999 if (line_attr) |
2993 wlv.char_attr = hl_combine_attr(line_attr, extra_attr); | 3000 wlv.char_attr = hl_combine_attr(line_attr, extra_attr); |
2994 else | 3001 else |