summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-12-02 19:46:57 +0000
committerBram Moolenaar <Bram@vim.org>2021-12-02 19:46:57 +0000
commitacdc911e4e1120ef29d86fce8e890c72cdd1bf30 (patch)
tree7bf3b5db9e650d3bce9dcfcb5a3c734ea0629d4c /src
parent5e86964bf48ddbfa20261bda84db391c80a36dca (diff)
downloadvim-git-acdc911e4e1120ef29d86fce8e890c72cdd1bf30.tar.gz
patch 8.2.3723: when using 'linebreak' a text property starts too earlyv8.2.3723
Problem: When using 'linebreak' a text property starts too early. Solution: Decrement "bcol" when looking for property start. (closes #9242)
Diffstat (limited to 'src')
-rw-r--r--src/drawline.c5
-rw-r--r--src/testdir/dumps/Test_prop_after_linebreak.dump10
-rw-r--r--src/testdir/test_textprop.vim18
-rw-r--r--src/version.c2
4 files changed, 35 insertions, 0 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 7d6d4fd8a..3106196e9 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1453,6 +1453,11 @@ win_line(
}
}
+# ifdef FEAT_LINEBREAK
+ if (n_extra > 0 && in_linebreak)
+ // not on the next char yet, don't start another prop
+ --bcol;
+# endif
// Add any text property that starts in this column.
while (text_prop_next < text_prop_count
&& bcol >= text_props[text_prop_next].tp_col - 1)
diff --git a/src/testdir/dumps/Test_prop_after_linebreak.dump b/src/testdir/dumps/Test_prop_after_linebreak.dump
new file mode 100644
index 000000000..7387c83b7
--- /dev/null
+++ b/src/testdir/dumps/Test_prop_after_linebreak.dump
@@ -0,0 +1,10 @@
+>x+0&#ffffff0@36|+| @36
+|(+0#ffffff16#e000002|x+0#0000000#ffffff0@36|)| @35
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index cc5d219ad..036dd7132 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1651,6 +1651,24 @@ func Test_prop_after_tab()
call delete('XscriptPropAfterTab')
endfunc
+func Test_prop_after_linebreak()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set linebreak wrap
+ call printf('%s+(%s)', 'x'->repeat(&columns / 2), 'x'->repeat(&columns / 2))->setline(1)
+ call prop_type_add('test', #{highlight: 'ErrorMsg'})
+ call prop_add(1, (&columns / 2) + 2, #{length: 1, type: 'test'})
+ END
+ call writefile(lines, 'XscriptPropAfterLinebreak')
+ let buf = RunVimInTerminal('-S XscriptPropAfterLinebreak', #{rows: 10})
+ call TermWait(buf)
+ call VerifyScreenDump(buf, 'Test_prop_after_linebreak', {})
+
+ call StopVimInTerminal(buf)
+ call delete('XscriptPropAfterLinebreak')
+endfunc
+
" Buffer number of 0 should be ignored, as if the parameter wasn't passed.
def Test_prop_bufnr_zero()
new
diff --git a/src/version.c b/src/version.c
index 0ae4d63aa..1c3f4c222 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3723,
+/**/
3722,
/**/
3721,