Skip to content

Commit bfd4512

Browse files
committed
patch 8.1.1340: attributes from 'cursorline' overwrite textprop
Problem: Attributes from 'cursorline' overwrite textprop. Solution: Combine the attributes. (closes #3912)
1 parent dabfde0 commit bfd4512

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

src/screen.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4306,11 +4306,15 @@ win_line(
43064306
char_attr = hl_combine_attr(line_attr, area_attr);
43074307
else if (search_attr != 0)
43084308
char_attr = hl_combine_attr(line_attr, search_attr);
4309-
/* Use line_attr when not in the Visual or 'incsearch' area
4310-
* (area_attr may be 0 when "noinvcur" is set). */
4309+
# ifdef FEAT_TEXT_PROP
4310+
else if (text_prop_type != NULL)
4311+
char_attr = hl_combine_attr(line_attr, text_prop_attr);
4312+
# endif
43114313
else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
43124314
|| vcol < fromcol || vcol_prev < fromcol_prev
43134315
|| vcol >= tocol))
4316+
// Use line_attr when not in the Visual or 'incsearch' area
4317+
// (area_attr may be 0 when "noinvcur" is set).
43144318
char_attr = line_attr;
43154319
#else
43164320
if (area_attr != 0)

src/testdir/dumps/Test_textprop_01.dump

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
| +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63
22
| +0#af5f00255&@1|2| |N+0#0000000#ffff4012|u|m|b|é|r| |1+0#4040ff13&|2|3| +0#0000000&|ä|n|d| |t|h|œ|n| |4+0#4040ff13&|¾|7|.+0#0000000&| +0&#ffffff0@46
3-
| +0#af5f00255&@1|3| >-+0#0000000#ffff4012|x+0&#ffffff0|a+0#4040ff13&@1|x+0#0000000&|-@1|x+0#4040ff13&|b@1|x+0#0000000&|-@1|x|c+0#4040ff13&@1|x|-+0#0000000&@1|x+0#4040ff13&|d@1|x|-+0#0000000&@1| @45
3+
| +0#af5f00255&@1|3| >-+8#0000000#ffff4012|x+8&#ffffff0|a+8#4040ff13&@1|x+8#0000000&|-@1|x+8#4040ff13&|b@1|x+8#0000000&|-@1|x|c+8#4040ff13&@1|x|-+8#0000000&@1|x+8#4040ff13&|d@1|x|-+8#0000000&@1| @45
44
| +0#af5f00255&@1|4| |/+0#40ff4011&@1| |c|o|m@1|e|n|t| |w+0&#e0e0e08|i|t|h| |e+8&&|r@1|o|r| +0&#ffffff0|i|n| |i|t| +0#0000000&@43
55
|~+0#4040ff13&| @73
66
|~| @73

src/testdir/test_textprop.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ funct Test_textprop_screenshots()
645645
\ "call prop_add(3, 15, {'length': 2, 'type': 'both'})",
646646
\ "call prop_add(4, 12, {'length': 10, 'type': 'background'})",
647647
\ "call prop_add(4, 17, {'length': 5, 'type': 'error'})",
648-
\ "set number",
648+
\ "set number cursorline",
649649
\ "hi clear SpellBad",
650650
\ "set spell",
651651
\ "syn match Comment '//.*'",

src/textprop.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
* Text properties implementation. See ":help text-properties".
1212
*
1313
* TODO:
14-
* - When using 'cursorline' attributes should be merged. (#3912)
1514
* - Adjust text property column and length when text is inserted/deleted.
16-
* -> splitting a line can create a zero-length property. Don't highlight it
17-
* and extend it when inserting text.
1815
* -> a :substitute with a multi-line match
1916
* -> join two lines, also with BS in Insert mode
2017
* -> search for changed_bytes() from misc1.c

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1340,
770772
/**/
771773
1339,
772774
/**/

0 commit comments

Comments
 (0)