To: vim_dev@googlegroups.com Subject: Patch 8.1.2279 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2279 Problem: Computation of highlight attributes is too complicated. Solution: Simplify the attribute computation and make it more consistent. (closes #5190) Fix that 'combine' set to zero doesn't work. Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_textprop_01.dump *** ../vim-8.1.2278/src/drawline.c 2019-11-03 15:46:40.614538718 +0100 --- src/drawline.c 2019-11-09 21:21:47.395469456 +0100 *************** *** 1470,1475 **** --- 1470,1485 ---- # endif } } + # ifdef FEAT_TEXT_PROP + // Combine text property highlight into syntax highlight. + if (text_prop_type != NULL) + { + if (text_prop_combine) + syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr); + else + syntax_attr = text_prop_attr; + } + # endif #endif // Decide which of the highlight attributes to use. *************** *** 1479,1506 **** { char_attr = hl_combine_attr(line_attr, area_attr); # ifdef FEAT_SYN_HL ! if (syntax_attr != 0) ! char_attr = hl_combine_attr(syntax_attr, char_attr); # endif } else if (search_attr != 0) { char_attr = hl_combine_attr(line_attr, search_attr); # ifdef FEAT_SYN_HL ! if (syntax_attr != 0) ! char_attr = hl_combine_attr(syntax_attr, char_attr); # endif } - # ifdef FEAT_TEXT_PROP - else if (text_prop_type != NULL) - { - char_attr = hl_combine_attr(line_attr != 0 - ? line_attr - : syntax_attr != 0 - ? syntax_attr - : win_attr, text_prop_attr); - } - # endif else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) || vcol < fromcol || vcol_prev < fromcol_prev || vcol >= tocol)) --- 1489,1504 ---- { char_attr = hl_combine_attr(line_attr, area_attr); # ifdef FEAT_SYN_HL ! char_attr = hl_combine_attr(syntax_attr, char_attr); # endif } else if (search_attr != 0) { char_attr = hl_combine_attr(line_attr, search_attr); # ifdef FEAT_SYN_HL ! char_attr = hl_combine_attr(syntax_attr, char_attr); # endif } else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) || vcol < fromcol || vcol_prev < fromcol_prev || vcol >= tocol)) *************** *** 1508,1518 **** // Use line_attr when not in the Visual or 'incsearch' area // (area_attr may be 0 when "noinvcur" is set). # ifdef FEAT_SYN_HL ! if (syntax_attr != 0) ! char_attr = hl_combine_attr(syntax_attr, line_attr); ! else # endif - char_attr = line_attr; attr_pri = FALSE; } #else --- 1506,1515 ---- // Use line_attr when not in the Visual or 'incsearch' area // (area_attr may be 0 when "noinvcur" is set). # ifdef FEAT_SYN_HL ! char_attr = hl_combine_attr(syntax_attr, line_attr); ! # else ! char_attr = line_attr; # endif attr_pri = FALSE; } #else *************** *** 1524,1545 **** else { attr_pri = FALSE; - #ifdef FEAT_TEXT_PROP - if (text_prop_type != NULL) - { - if (text_prop_combine) - char_attr = hl_combine_attr( - syntax_attr, text_prop_attr); - else - char_attr = hl_combine_attr( - win_attr, text_prop_attr); - } - else - #endif #ifdef FEAT_SYN_HL ! char_attr = syntax_attr; #else ! char_attr = 0; #endif } } --- 1521,1530 ---- else { attr_pri = FALSE; #ifdef FEAT_SYN_HL ! char_attr = syntax_attr; #else ! char_attr = 0; #endif } } *** ../vim-8.1.2278/src/testdir/test_textprop.vim 2019-10-25 22:13:26.273408806 +0200 --- src/testdir/test_textprop.vim 2019-11-09 21:13:13.433470483 +0100 *************** *** 678,685 **** \ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})", \ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})", \ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})", ! \ "call prop_type_add('background', {'highlight': 'NumberProp', 'combine': 1})", ! \ "eval 'background'->prop_type_change({'highlight': 'BackgroundProp'})", \ "call prop_type_add('error', {'highlight': 'UnderlineProp', 'combine': 1})", \ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})", \ "call prop_add(2, 9, {'length': 3, 'type': 'number'})", --- 678,686 ---- \ "call prop_type_add('start', {'highlight': 'NumberProp', 'start_incl': 1})", \ "call prop_type_add('end', {'highlight': 'NumberProp', 'end_incl': 1})", \ "call prop_type_add('both', {'highlight': 'NumberProp', 'start_incl': 1, 'end_incl': 1})", ! \ "call prop_type_add('background', {'highlight': 'BackgroundProp', 'combine': 0})", ! \ "call prop_type_add('backgroundcomb', {'highlight': 'NumberProp', 'combine': 1})", ! \ "eval 'backgroundcomb'->prop_type_change({'highlight': 'BackgroundProp'})", \ "call prop_type_add('error', {'highlight': 'UnderlineProp', 'combine': 1})", \ "call prop_add(1, 4, {'end_lnum': 3, 'end_col': 3, 'type': 'long'})", \ "call prop_add(2, 9, {'length': 3, 'type': 'number'})", *************** *** 688,694 **** \ "call prop_add(3, 7, {'length': 2, 'type': 'start'})", \ "call prop_add(3, 11, {'length': 2, 'type': 'end'})", \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})", ! \ "call prop_add(4, 12, {'length': 10, 'type': 'background'})", \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})", \ "call prop_add(5, 7, {'length': 4, 'type': 'long'})", \ "call prop_add(6, 1, {'length': 8, 'type': 'long'})", --- 689,696 ---- \ "call prop_add(3, 7, {'length': 2, 'type': 'start'})", \ "call prop_add(3, 11, {'length': 2, 'type': 'end'})", \ "call prop_add(3, 15, {'length': 2, 'type': 'both'})", ! \ "call prop_add(4, 6, {'length': 3, 'type': 'background'})", ! \ "call prop_add(4, 12, {'length': 10, 'type': 'backgroundcomb'})", \ "call prop_add(4, 17, {'length': 5, 'type': 'error'})", \ "call prop_add(5, 7, {'length': 4, 'type': 'long'})", \ "call prop_add(6, 1, {'length': 8, 'type': 'long'})", *** ../vim-8.1.2278/src/testdir/dumps/Test_textprop_01.dump 2019-09-14 21:00:01.387100866 +0200 --- src/testdir/dumps/Test_textprop_01.dump 2019-11-09 21:17:04.936537817 +0100 *************** *** 1,7 **** | +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63 | +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 | +8#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 ! | +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 | +0#af5f00255&@1|5| |f+0#0000000&|i|r|s|t| |l+0&#ffff4012|i|n|e| @1|s|e|c|o|n|d| +0&#ffffff0|l|i|n|e| @1|t|h|i|r|d| |l|i|n|e| |f|o|u|r|t|h| |l+0&#ffff4012|i|n|e| +0&#ffffff0@23 |~+0#4040ff13&| @73 |~| @73 --- 1,7 ---- | +0#af5f00255#ffffff0@1|1| |O+0#0000000&|n|e| +0&#ffff4012|t|w|o| +0&#ffffff0@63 | +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 | +8#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 ! | +0#af5f00255&@1|4| |/+0#40ff4011&@1| |c|o|m+0#0000000#e0e0e08@1|e|n+0#40ff4011#ffffff0|t| |w+0&#e0e0e08|i|t|h| |e+8&&|r@1|o|r| +0&#ffffff0|i|n| |i|t| +0#0000000&@43 | +0#af5f00255&@1|5| |f+0#0000000&|i|r|s|t| |l+0&#ffff4012|i|n|e| @1|s|e|c|o|n|d| +0&#ffffff0|l|i|n|e| @1|t|h|i|r|d| |l|i|n|e| |f|o|u|r|t|h| |l+0&#ffff4012|i|n|e| +0&#ffffff0@23 |~+0#4040ff13&| @73 |~| @73 *** ../vim-8.1.2278/src/version.c 2019-11-09 20:10:13.145483426 +0100 --- src/version.c 2019-11-09 21:27:39.146200035 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2279, /**/ -- hundred-and-one symptoms of being an internet addict: 53. To find out what time it is, you send yourself an e-mail and check the "Date:" field. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///