summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-02-10 17:20:28 +0100
committerBram Moolenaar <Bram@vim.org>2021-02-10 17:20:28 +0100
commitf3fa18468c0adc4fa645f7c394d7a6d14d3d4352 (patch)
treeafa56d87d87648bce9687cd69b9f9313b9e631a3
parentb17ec4d427f9009eff5dbc3184b26d68b0163edb (diff)
downloadvim-git-f3fa18468c0adc4fa645f7c394d7a6d14d3d4352.tar.gz
patch 8.2.2493: text property for text left of window shows upv8.2.2493
Problem: Text property for text left of window shows up. Solution: Check if the text property ends before the current column. (closes #7806)
-rw-r--r--src/drawline.c7
-rw-r--r--src/testdir/dumps/Test_textprop_nowrap_01.dump6
-rw-r--r--src/testdir/dumps/Test_textprop_nowrap_02.dump6
-rw-r--r--src/testdir/test_textprop.vim24
-rw-r--r--src/version.c2
5 files changed, 44 insertions, 1 deletions
diff --git a/src/drawline.c b/src/drawline.c
index 4dde0d074..077e7fcde 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -1418,7 +1418,12 @@ win_line(
// 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)
- text_prop_idxs[text_props_active++] = text_prop_next++;
+ {
+ if (bcol <= text_props[text_prop_next].tp_col - 1
+ + text_props[text_prop_next].tp_len)
+ text_prop_idxs[text_props_active++] = text_prop_next;
+ ++text_prop_next;
+ }
text_prop_attr = 0;
text_prop_combine = FALSE;
diff --git a/src/testdir/dumps/Test_textprop_nowrap_01.dump b/src/testdir/dumps/Test_textprop_nowrap_01.dump
new file mode 100644
index 000000000..f0fe7db27
--- /dev/null
+++ b/src/testdir/dumps/Test_textprop_nowrap_01.dump
@@ -0,0 +1,6 @@
+>a+0&#ffffff0|l@1|e|r| |t|h|a|n| |4+0#ffffff16#e000002|5|6|7|.+0#0000000#ffffff0|X@58
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|2|1| @9|A|l@1|
diff --git a/src/testdir/dumps/Test_textprop_nowrap_02.dump b/src/testdir/dumps/Test_textprop_nowrap_02.dump
new file mode 100644
index 000000000..104c67427
--- /dev/null
+++ b/src/testdir/dumps/Test_textprop_nowrap_02.dump
@@ -0,0 +1,6 @@
+|X+0&#ffffff0@36>X| @36
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1@2| @8|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 245533567..469d9f77d 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -1049,6 +1049,30 @@ func Test_textprop_after_tab()
call delete('XtestPropTab')
endfunc
+func Test_textprop_nowrap_scrolled()
+ CheckScreendump
+
+ let lines =<< trim END
+ vim9script
+ set nowrap
+ setline(1, 'The number 123 is smaller than 4567.' .. repeat('X', &columns))
+ prop_type_add('number', {'highlight': 'ErrorMsg'})
+ prop_add(1, 12, {'length': 3, 'type': 'number'})
+ prop_add(1, 32, {'length': 4, 'type': 'number'})
+ feedkeys('gg20zl', 'nxt')
+ END
+ call writefile(lines, 'XtestNowrap')
+ let buf = RunVimInTerminal('-S XtestNowrap', {'rows': 6})
+ call VerifyScreenDump(buf, 'Test_textprop_nowrap_01', {})
+
+ call term_sendkeys(buf, "$")
+ call VerifyScreenDump(buf, 'Test_textprop_nowrap_02', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestNowrap')
+endfunc
+
func Test_textprop_with_syntax()
CheckScreendump
diff --git a/src/version.c b/src/version.c
index 0209fd2b8..d787ca7b6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2493,
+/**/
2492,
/**/
2491,