To: vim_dev@googlegroups.com Subject: Patch 9.0.1067 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1067 Problem: In diff mode virtual text is highlighted incorrectly. (Rick Howe) Solution: Do not use diff attributes for virtual text. (closes #11714) Files: src/drawline.c, src/testdir/test_textprop.vim, src/testdir/dumps/Test_prop_diff_mode_1.dump, src/testdir/dumps/Test_prop_diff_mode_2.dump *** ../vim-9.0.1066/src/drawline.c 2022-12-12 13:20:37.622734681 +0000 --- src/drawline.c 2022-12-17 11:23:44.430939892 +0000 *************** *** 2206,2216 **** #ifdef FEAT_DIFF if (wlv.diff_hlf != (hlf_T)0) { if (wlv.diff_hlf == HLF_CHD && ptr - line >= change_start && wlv.n_extra == 0) wlv.diff_hlf = HLF_TXD; // changed text ! if (wlv.diff_hlf == HLF_TXD && ptr - line > change_end ! && wlv.n_extra == 0) wlv.diff_hlf = HLF_CHD; // changed line wlv.line_attr = HL_ATTR(wlv.diff_hlf); if (wp->w_p_cul && lnum == wp->w_cursor.lnum --- 2206,2218 ---- #ifdef FEAT_DIFF if (wlv.diff_hlf != (hlf_T)0) { + // When there is extra text (e.g. virtual text) it gets the + // diff highlighting for the line, but not for changed text. if (wlv.diff_hlf == HLF_CHD && ptr - line >= change_start && wlv.n_extra == 0) wlv.diff_hlf = HLF_TXD; // changed text ! if (wlv.diff_hlf == HLF_TXD && (ptr - line > change_end ! || wlv.n_extra > 0)) wlv.diff_hlf = HLF_CHD; // changed line wlv.line_attr = HL_ATTR(wlv.diff_hlf); if (wp->w_p_cul && lnum == wp->w_cursor.lnum *** ../vim-9.0.1066/src/testdir/test_textprop.vim 2022-12-06 14:17:32.178527467 +0000 --- src/testdir/test_textprop.vim 2022-12-17 11:30:22.774879581 +0000 *************** *** 3696,3700 **** --- 3696,3730 ---- call StopVimInTerminal(buf) endfunc + func Test_text_prop_diff_mode() + CheckRunVimInTerminal + + let lines =<< trim END + call setline(1, ['9000', '0009', '0009', '9000', '0009']) + + let type = 'test' + call prop_type_add(type, {}) + let text = '' + call prop_add(1, 1, {'type': type, 'text': text}) + call prop_add(2, 0, {'type': type, 'text': text, 'text_align': 'after'}) + call prop_add(3, 0, {'type': type, 'text': text, 'text_align': 'right'}) + call prop_add(4, 0, {'type': type, 'text': text, 'text_align': 'above'}) + call prop_add(5, 0, {'type': type, 'text': text, 'text_align': 'below'}) + set diff + + vnew + call setline(1, ['000', '000', '000', '000', '000']) + set diff + END + call writefile(lines, 'XtextPropDiff', 'D') + let buf = RunVimInTerminal('-S XtextPropDiff', #{rows: 10, cols: 60}) + call VerifyScreenDump(buf, 'Test_prop_diff_mode_1', {}) + + call term_sendkeys(buf, ":windo set number\") + call VerifyScreenDump(buf, 'Test_prop_diff_mode_2', {}) + + call StopVimInTerminal(buf) + endfunc + " vim: shiftwidth=2 sts=2 expandtab *** ../vim-9.0.1066/src/testdir/dumps/Test_prop_diff_mode_1.dump 2022-12-17 11:32:19.114860065 +0000 --- src/testdir/dumps/Test_prop_diff_mode_1.dump 2022-12-17 11:28:19.242883077 +0000 *************** *** 0 **** --- 1,10 ---- + >0+0&#ffd7ff255@2| @26||+1&#ffffff0|<+0&#ffd7ff255|t|e|x|t|>|9+2&#ff404010|0+0&#ffd7ff255@2| @18 + |0@2| @26||+1&#ffffff0|0+0&#ffd7ff255@2|9+2&#ff404010|<+0&#ffd7ff255|t|e|x|t|>| @18 + |0@2| @26||+1&#ffffff0|0+0&#ffd7ff255@2|9+2&#ff404010| +0&#ffd7ff255@18|<|t|e|x|t|> + |0@2| @26||+1&#ffffff0|<+0&#ffd7ff255|t|e|x|t|>| @22 + |0@2| @26||+1&#ffffff0|9+2&#ff404010|0+0&#ffd7ff255@2| @24 + |~+0#4040ff13#ffffff0| @28||+1#0000000&|0+0&#ffd7ff255@2|9+2&#ff404010| +0&#ffd7ff255@24 + |~+0#4040ff13#ffffff0| @28||+1#0000000&|<+0&#ffd7ff255|t|e|x|t|>| @22 + |~+0#4040ff13#ffffff0| @28||+1#0000000&|~+0#4040ff13&| @27 + |[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @1|1|,|1| @8|A|l@1| |[+1&&|N|o| |N|a|m|e|]| |[|+|]| @1|1|,|1|-|7| @5|A|l@1 + | +0&&@59 *** ../vim-9.0.1066/src/testdir/dumps/Test_prop_diff_mode_2.dump 2022-12-17 11:32:19.118860067 +0000 --- src/testdir/dumps/Test_prop_diff_mode_2.dump 2022-12-17 11:30:33.626878364 +0000 *************** *** 0 **** --- 1,10 ---- + | +0#af5f00255#ffffff0@1|1| |0+0#0000000#ffd7ff255@2| @22||+1&#ffffff0| +0#af5f00255&@1|1| |<+0#0000000#ffd7ff255|t|e|x|t|>>9+2&#ff404010|0+0&#ffd7ff255@2| @14 + | +0#af5f00255#ffffff0@1|2| |0+0#0000000#ffd7ff255@2| @22||+1&#ffffff0| +0#af5f00255&@1|2| |0+0#0000000#ffd7ff255@2|9+2&#ff404010|<+0&#ffd7ff255|t|e|x|t|>| @14 + | +0#af5f00255#ffffff0@1|3| |0+0#0000000#ffd7ff255@2| @22||+1&#ffffff0| +0#af5f00255&@1|3| |0+0#0000000#ffd7ff255@2|9+2&#ff404010| +0&#ffd7ff255@14|<|t|e|x|t|> + | +0#af5f00255#ffffff0@1|4| |0+0#0000000#ffd7ff255@2| @22||+1&#ffffff0| +0#af5f00255&@3|<+0#0000000#ffd7ff255|t|e|x|t|>| @18 + | +0#af5f00255#ffffff0@1|5| |0+0#0000000#ffd7ff255@2| @22||+1&#ffffff0| +0#af5f00255&@1|4| |9+2#0000000#ff404010|0+0&#ffd7ff255@2| @20 + |~+0#4040ff13#ffffff0| @28||+1#0000000&| +0#af5f00255&@1|5| |0+0#0000000#ffd7ff255@2|9+2&#ff404010| +0&#ffd7ff255@20 + |~+0#4040ff13#ffffff0| @28||+1#0000000&| +0#af5f00255&@3|<+0#0000000#ffd7ff255|t|e|x|t|>| @18 + |~+0#4040ff13#ffffff0| @28||+1#0000000&|~+0#4040ff13&| @27 + |[+1#0000000&|N|o| |N|a|m|e|]| |[|+|]| @1|1|,|1| @8|A|l@1| |[+3&&|N|o| |N|a|m|e|]| |[|+|]| @1|1|,|1|-|7| @5|A|l@1 + |:+0&&|w|i|n|d|o| |s|e|t| |n|u|m|b|e|r| @42 *** ../vim-9.0.1066/src/version.c 2022-12-17 10:40:07.171464572 +0000 --- src/version.c 2022-12-17 11:25:58.618859226 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1067, /**/ -- FATHER: Did you kill all those guards? LAUNCELOT: Yes ... I'm very sorry ... FATHER: They cost fifty pounds each! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///