summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-19 17:34:24 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-19 17:34:24 +0200
commita956bf6ca34896c3f242bf726b709a725f9053ce (patch)
tree6b986ab92a2b64bef96681ef520c4d8cdad161ac
parent4dff4aed09d2b0d570ca0d19de9cb08bdf03e695 (diff)
patch 8.1.1571: textprop highlight starts too early if just after a tabv8.1.1571
Problem: textprop highlight starts too early if just after a tab. Solution: Check if still drawing a previous character. (closes #4558)
-rw-r--r--src/screen.c3
-rw-r--r--src/testdir/dumps/Test_textprop_tab.dump6
-rw-r--r--src/testdir/test_textprop.vim20
-rw-r--r--src/version.c2
4 files changed, 31 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c
index 05639c30b7..d2227a8884 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4391,6 +4391,9 @@ win_line(
int pi;
int bcol = (int)(ptr - line);
+ if (n_extra > 0)
+ --bcol; // still working on the previous char, e.g. Tab
+
// Check if any active property ends.
for (pi = 0; pi < text_props_active; ++pi)
{
diff --git a/src/testdir/dumps/Test_textprop_tab.dump b/src/testdir/dumps/Test_textprop_tab.dump
new file mode 100644
index 0000000000..a1b77055cf
--- /dev/null
+++ b/src/testdir/dumps/Test_textprop_tab.dump
@@ -0,0 +1,6 @@
+| +0&#ffffff0@6> |x+0&#ffff4012@2| +0&#ffffff0@63
+|x| @6|x+0&#ffff4012@2| +0&#ffffff0@63
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1|-|8| @8|A|l@1|
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 08c079cfa4..36eeb709b8 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -759,6 +759,26 @@ func Test_textprop_screenshot_visual()
call RunTestVisualBlock(4, '02')
endfunc
+func Test_textprop_after_tab()
+ let lines =<< trim END
+ call setline(1, [
+ \ "\txxx",
+ \ "x\txxx",
+ \ ])
+ hi SearchProp ctermbg=yellow
+ call prop_type_add('search', {'highlight': 'SearchProp'})
+ call prop_add(1, 2, {'length': 3, 'type': 'search'})
+ call prop_add(2, 3, {'length': 3, 'type': 'search'})
+ END
+ call writefile(lines, 'XtestPropTab')
+ let buf = RunVimInTerminal('-S XtestPropTab', {'rows': 6})
+ call VerifyScreenDump(buf, 'Test_textprop_tab', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPropTab')
+endfunc
+
" Adding a text property to a new buffer should not fail
func Test_textprop_empty_buffer()
call prop_type_add('comment', {'highlight': 'Search'})
diff --git a/src/version.c b/src/version.c
index d71b86e13f..19b6aa76d5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -778,6 +778,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1571,
+/**/
1570,
/**/
1569,