]> granicus.if.org Git - vim/commitdiff
patch 8.1.1337: get empty text prop when splitting line just after text prop v8.1.1337
authorBram Moolenaar <Bram@vim.org>
Fri, 17 May 2019 09:08:56 +0000 (11:08 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 May 2019 09:08:56 +0000 (11:08 +0200)
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.

src/testdir/test_textprop.vim
src/textprop.c
src/version.c

index 6cc38d56634770da65cb9057eebcd73ef36dc141..237eda95fbffdc86cd6f3119bbd0f9da2a4ef966 100644 (file)
@@ -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()
 
index 8c1e46ca680e2b07377d24c4336f983bd17e2015..361ecb12693ec7bce051442c2c320a17061b4457 100644 (file)
@@ -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;
index 01c4394960464599f273c4ef334277917e7ce9ad..c34eed04f664b2c62bbad593918ba048455163d6 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1337,
 /**/
     1336,
 /**/