summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-12-17 11:33:00 +0000
committerBram Moolenaar <Bram@vim.org>2022-12-17 11:33:00 +0000
commitd097af77797f030e0f29f9bbc298358a5addb2a5 (patch)
tree2b3d56eac0b4ea64a1deed748705cddb4f5d44df
parent67f3094397a40bea051a8e99921a8bf6f45d6147 (diff)
patch 9.0.1067: in diff mode virtual text is highlighted incorrectlyv9.0.1067
Problem: In diff mode virtual text is highlighted incorrectly. (Rick Howe) Solution: Do not use diff attributes for virtual text. (closes #11714)
-rw-r--r--src/drawline.c6
-rw-r--r--src/testdir/dumps/Test_prop_diff_mode_1.dump10
-rw-r--r--src/testdir/dumps/Test_prop_diff_mode_2.dump10
-rw-r--r--src/testdir/test_textprop.vim30
-rw-r--r--src/version.c2
5 files changed, 56 insertions, 2 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 0e090f42d1..79b187ff0e 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -2206,11 +2206,13 @@ win_line(
#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)
+ 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
diff --git a/src/testdir/dumps/Test_prop_diff_mode_1.dump b/src/testdir/dumps/Test_prop_diff_mode_1.dump
new file mode 100644
index 0000000000..069c08d79c
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_diff_mode_1.dump
@@ -0,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
diff --git a/src/testdir/dumps/Test_prop_diff_mode_2.dump b/src/testdir/dumps/Test_prop_diff_mode_2.dump
new file mode 100644
index 0000000000..243ec0dc18
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_diff_mode_2.dump
@@ -0,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
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 1bda87fe99..333c3b2c97 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -3696,5 +3696,35 @@ func Test_text_prop_delete_updates()
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 = '<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\<CR>")
+ call VerifyScreenDump(buf, 'Test_prop_diff_mode_2', {})
+
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index d8fe1540de..7722f3d89e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1067,
+/**/
1066,
/**/
1065,