Mercurial > vim
comparison src/drawline.c @ 26338:4cf208415483 v8.2.3700
patch 8.2.3700: text property highlighting continues over breakindent
Commit: https://github.com/vim/vim/commit/6b839ac77586f69a814d2940f59f0125f55c5f81
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Nov 29 21:12:35 2021 +0000
patch 8.2.3700: text property highlighting continues over breakindent
Problem: Text property highlighting continues over breakindent.
Solution: Stop before the end column. (closes https://github.com/vim/vim/issues/9242)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 29 Nov 2021 22:15:03 +0100 |
parents | baec4e1cee43 |
children | 13cce5c82c9a |
comparison
equal
deleted
inserted
replaced
26337:ab47e2ca4673 | 26338:4cf208415483 |
---|---|
263 char_u *p_extra = NULL; // string of extra chars, plus NUL | 263 char_u *p_extra = NULL; // string of extra chars, plus NUL |
264 char_u *p_extra_free = NULL; // p_extra needs to be freed | 264 char_u *p_extra_free = NULL; // p_extra needs to be freed |
265 int c_extra = NUL; // extra chars, all the same | 265 int c_extra = NUL; // extra chars, all the same |
266 int c_final = NUL; // final char, mandatory if set | 266 int c_final = NUL; // final char, mandatory if set |
267 int extra_attr = 0; // attributes when n_extra != 0 | 267 int extra_attr = 0; // attributes when n_extra != 0 |
268 #ifdef FEAT_LINEBREAK | |
269 int in_linebreak = FALSE; // n_extra set for showing linebreak | |
270 #endif | |
268 static char_u *at_end_str = (char_u *)""; // used for p_extra when | 271 static char_u *at_end_str = (char_u *)""; // used for p_extra when |
269 // displaying eol at end-of-line | 272 // displaying eol at end-of-line |
270 int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used | 273 int lcs_eol_one = wp->w_lcs_chars.eol; // eol until it's been used |
271 int lcs_prec_todo = wp->w_lcs_chars.prec; // prec until it's been used | 274 int lcs_prec_todo = wp->w_lcs_chars.prec; // prec until it's been used |
272 | 275 |
1417 if (text_props != NULL) | 1420 if (text_props != NULL) |
1418 { | 1421 { |
1419 int pi; | 1422 int pi; |
1420 int bcol = (int)(ptr - line); | 1423 int bcol = (int)(ptr - line); |
1421 | 1424 |
1422 if (n_extra > 0) | 1425 if (n_extra > 0 |
1426 # ifdef FEAT_LINEBREAK | |
1427 && !in_linebreak | |
1428 # endif | |
1429 ) | |
1423 --bcol; // still working on the previous char, e.g. Tab | 1430 --bcol; // still working on the previous char, e.g. Tab |
1424 | 1431 |
1425 // Check if any active property ends. | 1432 // Check if any active property ends. |
1426 for (pi = 0; pi < text_props_active; ++pi) | 1433 for (pi = 0; pi < text_props_active; ++pi) |
1427 { | 1434 { |
1435 text_prop_idxs + pi + 1, | 1442 text_prop_idxs + pi + 1, |
1436 sizeof(int) | 1443 sizeof(int) |
1437 * (text_props_active - (pi + 1))); | 1444 * (text_props_active - (pi + 1))); |
1438 --text_props_active; | 1445 --text_props_active; |
1439 --pi; | 1446 --pi; |
1447 # ifdef FEAT_LINEBREAK | |
1448 // not exactly right but should work in most cases | |
1449 if (in_linebreak && syntax_attr == text_prop_attr) | |
1450 syntax_attr = 0; | |
1451 # endif | |
1440 } | 1452 } |
1441 } | 1453 } |
1442 | 1454 |
1443 // Add any text property that starts in this column. | 1455 // Add any text property that starts in this column. |
1444 while (text_prop_next < text_prop_count | 1456 while (text_prop_next < text_prop_count |
1703 } | 1715 } |
1704 } | 1716 } |
1705 ++p_extra; | 1717 ++p_extra; |
1706 } | 1718 } |
1707 --n_extra; | 1719 --n_extra; |
1720 #ifdef FEAT_LINEBREAK | |
1721 if (n_extra <= 0) | |
1722 in_linebreak = FALSE; | |
1723 #endif | |
1708 } | 1724 } |
1709 else | 1725 else |
1710 { | 1726 { |
1711 #ifdef FEAT_LINEBREAK | 1727 #ifdef FEAT_LINEBREAK |
1712 int c0; | 1728 int c0; |
2028 - vcol % (int)wp->w_buffer->b_p_ts - 1; | 2044 - vcol % (int)wp->w_buffer->b_p_ts - 1; |
2029 # endif | 2045 # endif |
2030 | 2046 |
2031 c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' '; | 2047 c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' '; |
2032 c_final = NUL; | 2048 c_final = NUL; |
2049 if (n_extra > 0) | |
2050 in_linebreak = TRUE; | |
2033 if (VIM_ISWHITE(c)) | 2051 if (VIM_ISWHITE(c)) |
2034 { | 2052 { |
2035 # ifdef FEAT_CONCEAL | 2053 # ifdef FEAT_CONCEAL |
2036 if (c == TAB) | 2054 if (c == TAB) |
2037 // See "Tab alignment" below. | 2055 // See "Tab alignment" below. |