Mercurial > vim
comparison src/drawline.c @ 18795:79b689ff168d v8.1.2386
patch 8.1.2386: 'wincolor' is not used for 'listchars'
Commit: https://github.com/vim/vim/commit/42e931b0f52679d51de1a3832d1f2481512408fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 4 19:08:50 2019 +0100
patch 8.1.2386: 'wincolor' is not used for 'listchars'
Problem: 'wincolor' is not used for 'listchars'.
Solution: Combine the colors. (closes https://github.com/vim/vim/issues/5308)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 04 Dec 2019 19:15:04 +0100 |
parents | 38a3bef525e6 |
children | d5b793803236 |
comparison
equal
deleted
inserted
replaced
18794:99f9d7930215 | 18795:79b689ff168d |
---|---|
1220 // Draw 'showbreak' at the start of each broken line. | 1220 // Draw 'showbreak' at the start of each broken line. |
1221 p_extra = sbr; | 1221 p_extra = sbr; |
1222 c_extra = NUL; | 1222 c_extra = NUL; |
1223 c_final = NUL; | 1223 c_final = NUL; |
1224 n_extra = (int)STRLEN(sbr); | 1224 n_extra = (int)STRLEN(sbr); |
1225 char_attr = HL_ATTR(HLF_AT); | |
1226 need_showbreak = FALSE; | 1225 need_showbreak = FALSE; |
1227 vcol_sbr = vcol + MB_CHARLEN(sbr); | 1226 vcol_sbr = vcol + MB_CHARLEN(sbr); |
1228 // Correct end of highlighted area for 'showbreak', | 1227 // Correct end of highlighted area for 'showbreak', |
1229 // required when 'linebreak' is also set. | 1228 // required when 'linebreak' is also set. |
1230 if (tocol == vcol) | 1229 if (tocol == vcol) |
1231 tocol += n_extra; | 1230 tocol += n_extra; |
1232 // combine 'showbreak' with 'wincolor' | 1231 // combine 'showbreak' with 'wincolor' |
1233 char_attr = hl_combine_attr(win_attr, char_attr); | 1232 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
1234 # ifdef FEAT_SYN_HL | 1233 # ifdef FEAT_SYN_HL |
1235 // combine 'showbreak' with 'cursorline' | 1234 // combine 'showbreak' with 'cursorline' |
1236 if (cul_attr != 0) | 1235 if (cul_attr != 0) |
1237 char_attr = hl_combine_attr(char_attr, cul_attr); | 1236 char_attr = hl_combine_attr(char_attr, cul_attr); |
1238 # endif | 1237 # endif |
1699 c_extra = NUL; | 1698 c_extra = NUL; |
1700 c_final = NUL; | 1699 c_final = NUL; |
1701 if (area_attr == 0 && search_attr == 0) | 1700 if (area_attr == 0 && search_attr == 0) |
1702 { | 1701 { |
1703 n_attr = n_extra + 1; | 1702 n_attr = n_extra + 1; |
1704 extra_attr = HL_ATTR(HLF_8); | 1703 extra_attr = hl_combine_attr( |
1704 win_attr, HL_ATTR(HLF_8)); | |
1705 saved_attr2 = char_attr; // save current attr | 1705 saved_attr2 = char_attr; // save current attr |
1706 } | 1706 } |
1707 } | 1707 } |
1708 else if (mb_l == 0) // at the NUL at end-of-line | 1708 else if (mb_l == 0) // at the NUL at end-of-line |
1709 mb_l = 1; | 1709 mb_l = 1; |
1768 c_final = NUL; | 1768 c_final = NUL; |
1769 c = *p_extra++; | 1769 c = *p_extra++; |
1770 if (area_attr == 0 && search_attr == 0) | 1770 if (area_attr == 0 && search_attr == 0) |
1771 { | 1771 { |
1772 n_attr = n_extra + 1; | 1772 n_attr = n_extra + 1; |
1773 extra_attr = HL_ATTR(HLF_8); | 1773 extra_attr = hl_combine_attr( |
1774 win_attr, HL_ATTR(HLF_8)); | |
1774 saved_attr2 = char_attr; // save current attr | 1775 saved_attr2 = char_attr; // save current attr |
1775 } | 1776 } |
1776 mb_c = c; | 1777 mb_c = c; |
1777 } | 1778 } |
1778 } | 1779 } |
1812 c_final = NUL; | 1813 c_final = NUL; |
1813 c = ' '; | 1814 c = ' '; |
1814 if (area_attr == 0 && search_attr == 0) | 1815 if (area_attr == 0 && search_attr == 0) |
1815 { | 1816 { |
1816 n_attr = n_extra + 1; | 1817 n_attr = n_extra + 1; |
1817 extra_attr = HL_ATTR(HLF_AT); | 1818 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
1818 saved_attr2 = char_attr; // save current attr | 1819 saved_attr2 = char_attr; // save current attr |
1819 } | 1820 } |
1820 mb_c = c; | 1821 mb_c = c; |
1821 mb_utf8 = FALSE; | 1822 mb_utf8 = FALSE; |
1822 mb_l = 1; | 1823 mb_l = 1; |
1967 { | 1968 { |
1968 c = (c == ' ') ? lcs_space : lcs_nbsp; | 1969 c = (c == ' ') ? lcs_space : lcs_nbsp; |
1969 if (area_attr == 0 && search_attr == 0) | 1970 if (area_attr == 0 && search_attr == 0) |
1970 { | 1971 { |
1971 n_attr = 1; | 1972 n_attr = 1; |
1972 extra_attr = HL_ATTR(HLF_8); | 1973 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8)); |
1973 saved_attr2 = char_attr; // save current attr | 1974 saved_attr2 = char_attr; // save current attr |
1974 } | 1975 } |
1975 mb_c = c; | 1976 mb_c = c; |
1976 if (enc_utf8 && utf_char2len(c) > 1) | 1977 if (enc_utf8 && utf_char2len(c) > 1) |
1977 { | 1978 { |
1987 { | 1988 { |
1988 c = lcs_trail; | 1989 c = lcs_trail; |
1989 if (!attr_pri) | 1990 if (!attr_pri) |
1990 { | 1991 { |
1991 n_attr = 1; | 1992 n_attr = 1; |
1992 extra_attr = HL_ATTR(HLF_8); | 1993 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8)); |
1993 saved_attr2 = char_attr; // save current attr | 1994 saved_attr2 = char_attr; // save current attr |
1994 } | 1995 } |
1995 mb_c = c; | 1996 mb_c = c; |
1996 if (enc_utf8 && utf_char2len(c) > 1) | 1997 if (enc_utf8 && utf_char2len(c) > 1) |
1997 { | 1998 { |
2125 else | 2126 else |
2126 #endif | 2127 #endif |
2127 c_extra = lcs_tab2; | 2128 c_extra = lcs_tab2; |
2128 c_final = lcs_tab3; | 2129 c_final = lcs_tab3; |
2129 n_attr = tab_len + 1; | 2130 n_attr = tab_len + 1; |
2130 extra_attr = HL_ATTR(HLF_8); | 2131 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8)); |
2131 saved_attr2 = char_attr; // save current attr | 2132 saved_attr2 = char_attr; // save current attr |
2132 mb_c = c; | 2133 mb_c = c; |
2133 if (enc_utf8 && utf_char2len(c) > 1) | 2134 if (enc_utf8 && utf_char2len(c) > 1) |
2134 { | 2135 { |
2135 mb_utf8 = TRUE; | 2136 mb_utf8 = TRUE; |
2196 c = ' '; | 2197 c = ' '; |
2197 lcs_eol_one = -1; | 2198 lcs_eol_one = -1; |
2198 --ptr; // put it back at the NUL | 2199 --ptr; // put it back at the NUL |
2199 if (!attr_pri) | 2200 if (!attr_pri) |
2200 { | 2201 { |
2201 extra_attr = HL_ATTR(HLF_AT); | 2202 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
2202 n_attr = 1; | 2203 n_attr = 1; |
2203 } | 2204 } |
2204 mb_c = c; | 2205 mb_c = c; |
2205 if (enc_utf8 && utf_char2len(c) > 1) | 2206 if (enc_utf8 && utf_char2len(c) > 1) |
2206 { | 2207 { |
2242 c = *p_extra++; | 2243 c = *p_extra++; |
2243 } | 2244 } |
2244 if (!attr_pri) | 2245 if (!attr_pri) |
2245 { | 2246 { |
2246 n_attr = n_extra + 1; | 2247 n_attr = n_extra + 1; |
2247 extra_attr = HL_ATTR(HLF_8); | 2248 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8)); |
2248 saved_attr2 = char_attr; // save current attr | 2249 saved_attr2 = char_attr; // save current attr |
2249 } | 2250 } |
2250 mb_utf8 = FALSE; // don't draw as UTF-8 | 2251 mb_utf8 = FALSE; // don't draw as UTF-8 |
2251 } | 2252 } |
2252 else if (VIsual_active | 2253 else if (VIsual_active |
2501 // character, need to fill up half the character. | 2502 // character, need to fill up half the character. |
2502 c_extra = MB_FILLER_CHAR; | 2503 c_extra = MB_FILLER_CHAR; |
2503 c_final = NUL; | 2504 c_final = NUL; |
2504 n_extra = 1; | 2505 n_extra = 1; |
2505 n_attr = 2; | 2506 n_attr = 2; |
2506 extra_attr = HL_ATTR(HLF_AT); | 2507 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
2507 } | 2508 } |
2508 mb_c = c; | 2509 mb_c = c; |
2509 if (enc_utf8 && utf_char2len(c) > 1) | 2510 if (enc_utf8 && utf_char2len(c) > 1) |
2510 { | 2511 { |
2511 mb_utf8 = TRUE; | 2512 mb_utf8 = TRUE; |
2515 else | 2516 else |
2516 mb_utf8 = FALSE; // don't draw as UTF-8 | 2517 mb_utf8 = FALSE; // don't draw as UTF-8 |
2517 if (!attr_pri) | 2518 if (!attr_pri) |
2518 { | 2519 { |
2519 saved_attr3 = char_attr; // save current attr | 2520 saved_attr3 = char_attr; // save current attr |
2520 char_attr = HL_ATTR(HLF_AT); // later copied to char_attr | 2521 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
2521 n_attr3 = 1; | 2522 n_attr3 = 1; |
2522 } | 2523 } |
2523 } | 2524 } |
2524 | 2525 |
2525 // At end of the text line or just after the last character. | 2526 // At end of the text line or just after the last character. |
2723 && (*ptr != NUL | 2724 && (*ptr != NUL |
2724 || (wp->w_p_list && lcs_eol_one > 0) | 2725 || (wp->w_p_list && lcs_eol_one > 0) |
2725 || (n_extra && (c_extra != NUL || *p_extra != NUL)))) | 2726 || (n_extra && (c_extra != NUL || *p_extra != NUL)))) |
2726 { | 2727 { |
2727 c = lcs_ext; | 2728 c = lcs_ext; |
2728 char_attr = HL_ATTR(HLF_AT); | 2729 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT)); |
2729 mb_c = c; | 2730 mb_c = c; |
2730 if (enc_utf8 && utf_char2len(c) > 1) | 2731 if (enc_utf8 && utf_char2len(c) > 1) |
2731 { | 2732 { |
2732 mb_utf8 = TRUE; | 2733 mb_utf8 = TRUE; |
2733 u8cc[0] = 0; | 2734 u8cc[0] = 0; |