Mercurial > vim
comparison src/drawline.c @ 29706:a680dc1b089d v9.0.0193
patch 9.0.0193: search and match highlgith interfere with virtual text
Commit: https://github.com/vim/vim/commit/e38fc86180fd3f6b372648eea6adc3f623fea302
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 11 17:24:50 2022 +0100
patch 9.0.0193: search and match highlgith interfere with virtual text
Problem: Search and match highlgith interfere with virtual text highlight.
(Ben Jackson)
Solution: Check for match highlight after text properties. Reset and
restore search highlight when showing virtual text.
(closes #10892)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 11 Aug 2022 18:30:04 +0200 |
parents | b944b7fb563b |
children | f88671dbe88b |
comparison
equal
deleted
inserted
replaced
29705:a347400a24a9 | 29706:a680dc1b089d |
---|---|
556 proptype_T *text_prop_type = NULL; | 556 proptype_T *text_prop_type = NULL; |
557 int text_prop_attr = 0; | 557 int text_prop_attr = 0; |
558 int text_prop_id = 0; // active property ID | 558 int text_prop_id = 0; // active property ID |
559 int text_prop_flags = 0; | 559 int text_prop_flags = 0; |
560 int text_prop_follows = FALSE; // another text prop to display | 560 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 // goes to zero | |
561 #endif | 563 #endif |
562 #ifdef FEAT_SPELL | 564 #ifdef FEAT_SPELL |
563 int has_spell = FALSE; // this buffer has spell checking | 565 int has_spell = FALSE; // this buffer has spell checking |
564 int can_spell = FALSE; | 566 int can_spell = FALSE; |
565 # define SPWORDLEN 150 | 567 # define SPWORDLEN 150 |
1581 else if (area_attr != 0 | 1583 else if (area_attr != 0 |
1582 && (wlv.vcol == tocol | 1584 && (wlv.vcol == tocol |
1583 || (noinvcur && (colnr_T)wlv.vcol == wp->w_virtcol))) | 1585 || (noinvcur && (colnr_T)wlv.vcol == wp->w_virtcol))) |
1584 area_attr = 0; // stop highlighting | 1586 area_attr = 0; // stop highlighting |
1585 | 1587 |
1586 #ifdef FEAT_SEARCH_EXTRA | |
1587 if (!wlv.n_extra) | |
1588 { | |
1589 // Check for start/end of 'hlsearch' and other matches. | |
1590 // After end, check for start/end of next match. | |
1591 // When another match, have to check for start again. | |
1592 v = (long)(ptr - line); | |
1593 search_attr = update_search_hl(wp, lnum, (colnr_T)v, &line, | |
1594 &screen_search_hl, &has_match_conc, | |
1595 &match_conc, did_line_attr, lcs_eol_one, | |
1596 &on_last_col); | |
1597 ptr = line + v; // "line" may have been changed | |
1598 prev_ptr = ptr; | |
1599 | |
1600 // Do not allow a conceal over EOL otherwise EOL will be missed | |
1601 // and bad things happen. | |
1602 if (*ptr == NUL) | |
1603 has_match_conc = 0; | |
1604 } | |
1605 #endif | |
1606 | |
1607 #ifdef FEAT_DIFF | |
1608 if (wlv.diff_hlf != (hlf_T)0) | |
1609 { | |
1610 if (wlv.diff_hlf == HLF_CHD && ptr - line >= change_start | |
1611 && wlv.n_extra == 0) | |
1612 wlv.diff_hlf = HLF_TXD; // changed text | |
1613 if (wlv.diff_hlf == HLF_TXD && ptr - line > change_end | |
1614 && wlv.n_extra == 0) | |
1615 wlv.diff_hlf = HLF_CHD; // changed line | |
1616 line_attr = HL_ATTR(wlv.diff_hlf); | |
1617 if (wp->w_p_cul && lnum == wp->w_cursor.lnum | |
1618 && wp->w_p_culopt_flags != CULOPT_NBR | |
1619 && (!wlv.cul_screenline || (wlv.vcol >= left_curline_col | |
1620 && wlv.vcol <= right_curline_col))) | |
1621 line_attr = hl_combine_attr( | |
1622 line_attr, HL_ATTR(HLF_CUL)); | |
1623 } | |
1624 #endif | |
1625 | |
1626 #ifdef FEAT_PROP_POPUP | 1588 #ifdef FEAT_PROP_POPUP |
1627 if (text_props != NULL) | 1589 if (text_props != NULL) |
1628 { | 1590 { |
1629 int pi; | 1591 int pi; |
1630 int bcol = (int)(ptr - line); | 1592 int bcol = (int)(ptr - line); |
1746 wlv.c_extra = NUL; | 1708 wlv.c_extra = NUL; |
1747 wlv.c_final = NUL; | 1709 wlv.c_final = NUL; |
1748 wlv.n_extra = (int)STRLEN(p); | 1710 wlv.n_extra = (int)STRLEN(p); |
1749 extra_attr = used_attr; | 1711 extra_attr = used_attr; |
1750 n_attr = mb_charlen(p); | 1712 n_attr = mb_charlen(p); |
1713 saved_search_attr = search_attr; | |
1714 search_attr = 0; // restore when n_extra is zero | |
1751 text_prop_attr = 0; | 1715 text_prop_attr = 0; |
1752 if (*ptr == NUL) | 1716 if (*ptr == NUL) |
1753 // don't combine char attr after EOL | 1717 // don't combine char attr after EOL |
1754 text_prop_flags &= ~PT_FLAG_COMBINE; | 1718 text_prop_flags &= ~PT_FLAG_COMBINE; |
1755 #ifdef FEAT_LINEBREAK | 1719 #ifdef FEAT_LINEBREAK |
1854 // Or when not wrapping and at the rightmost column. | 1818 // Or when not wrapping and at the rightmost column. |
1855 text_prop_follows = TRUE; | 1819 text_prop_follows = TRUE; |
1856 } | 1820 } |
1857 #endif | 1821 #endif |
1858 | 1822 |
1823 #ifdef FEAT_SEARCH_EXTRA | |
1824 if (wlv.n_extra == 0) | |
1825 { | |
1826 // Check for start/end of 'hlsearch' and other matches. | |
1827 // After end, check for start/end of next match. | |
1828 // When another match, have to check for start again. | |
1829 v = (long)(ptr - line); | |
1830 search_attr = update_search_hl(wp, lnum, (colnr_T)v, &line, | |
1831 &screen_search_hl, &has_match_conc, | |
1832 &match_conc, did_line_attr, lcs_eol_one, | |
1833 &on_last_col); | |
1834 ptr = line + v; // "line" may have been changed | |
1835 prev_ptr = ptr; | |
1836 | |
1837 // Do not allow a conceal over EOL otherwise EOL will be missed | |
1838 // and bad things happen. | |
1839 if (*ptr == NUL) | |
1840 has_match_conc = 0; | |
1841 } | |
1842 #endif | |
1843 | |
1844 #ifdef FEAT_DIFF | |
1845 if (wlv.diff_hlf != (hlf_T)0) | |
1846 { | |
1847 if (wlv.diff_hlf == HLF_CHD && ptr - line >= change_start | |
1848 && wlv.n_extra == 0) | |
1849 wlv.diff_hlf = HLF_TXD; // changed text | |
1850 if (wlv.diff_hlf == HLF_TXD && ptr - line > change_end | |
1851 && wlv.n_extra == 0) | |
1852 wlv.diff_hlf = HLF_CHD; // changed line | |
1853 line_attr = HL_ATTR(wlv.diff_hlf); | |
1854 if (wp->w_p_cul && lnum == wp->w_cursor.lnum | |
1855 && wp->w_p_culopt_flags != CULOPT_NBR | |
1856 && (!wlv.cul_screenline || (wlv.vcol >= left_curline_col | |
1857 && wlv.vcol <= right_curline_col))) | |
1858 line_attr = hl_combine_attr( | |
1859 line_attr, HL_ATTR(HLF_CUL)); | |
1860 } | |
1861 #endif | |
1862 | |
1859 #ifdef FEAT_SYN_HL | 1863 #ifdef FEAT_SYN_HL |
1860 if (extra_check && wlv.n_extra == 0) | 1864 if (extra_check && wlv.n_extra == 0) |
1861 { | 1865 { |
1862 syntax_attr = 0; | 1866 syntax_attr = 0; |
1863 # ifdef FEAT_TERMINAL | 1867 # ifdef FEAT_TERMINAL |
2084 } | 2088 } |
2085 } | 2089 } |
2086 ++wlv.p_extra; | 2090 ++wlv.p_extra; |
2087 } | 2091 } |
2088 --wlv.n_extra; | 2092 --wlv.n_extra; |
2089 #if defined(FEAT_LINEBREAK) && defined(FEAT_PROP_POPUP) | 2093 #if defined(FEAT_PROP_POPUP) |
2090 if (wlv.n_extra <= 0) | 2094 if (wlv.n_extra <= 0) |
2095 { | |
2091 in_linebreak = FALSE; | 2096 in_linebreak = FALSE; |
2097 if (search_attr == 0) | |
2098 search_attr = saved_search_attr; | |
2099 } | |
2092 #endif | 2100 #endif |
2093 } | 2101 } |
2094 else | 2102 else |
2095 { | 2103 { |
2096 #ifdef FEAT_LINEBREAK | 2104 #ifdef FEAT_LINEBREAK |