summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-17 11:08:56 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-17 11:08:56 +0200
commit5c65e6a062dfc7d20931fa1f73d03b1714a4d5e1 (patch)
treeaa2fb3f679bb6c2837b0c640f43ee721c78358c8
parent17aca707f92235b6f962e637e8073162d18e6de2 (diff)
downloadvim-git-5c65e6a062dfc7d20931fa1f73d03b1714a4d5e1.tar.gz
patch 8.1.1337: get empty text prop when splitting line just after text propv8.1.1337
Problem: Get empty text prop when splitting line just after text prop. Solution: Do not create an empty text prop at the start of the line.
-rw-r--r--src/testdir/test_textprop.vim7
-rw-r--r--src/textprop.c4
-rw-r--r--src/version.c2
3 files changed, 8 insertions, 5 deletions
diff --git a/src/testdir/test_textprop.vim b/src/testdir/test_textprop.vim
index 6cc38d566..237eda95f 100644
--- a/src/testdir/test_textprop.vim
+++ b/src/testdir/test_textprop.vim
@@ -316,16 +316,15 @@ func Test_prop_open_line()
call assert_equal(expected, prop_list(2))
call DeletePropTypes()
- " split just after first prop, empty prop and second prop move to next line
+ " split just after first prop, second prop move to next line
let expected = SetupOneLine() " 'xonex xtwoxx'
exe "normal 0fea\<CR>\<Esc>"
call assert_equal('xone', getline(1))
call assert_equal('x xtwoxx', getline(2))
let exp_first = expected[0:0]
call assert_equal(exp_first, prop_list(1))
- let expected[0].col = 1
- let expected[0].length = 0
- let expected[1].col -= 4
+ let expected = expected[1:1]
+ let expected[0].col -= 4
call assert_equal(expected, prop_list(2))
call DeletePropTypes()
diff --git a/src/textprop.c b/src/textprop.c
index 8c1e46ca6..361ecb126 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1075,7 +1075,9 @@ adjust_props_for_split(
++prevprop.ga_len;
}
- if (prop.tp_col + prop.tp_len >= skipped && ga_grow(&nextprop, 1) == OK)
+ // Only add the property to the next line if the length is bigger than
+ // zero.
+ if (prop.tp_col + prop.tp_len > skipped && ga_grow(&nextprop, 1) == OK)
{
p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len;
*p = prop;
diff --git a/src/version.c b/src/version.c
index 01c439496..c34eed04f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1337,
+/**/
1336,
/**/
1335,