Patch 8.1.1337

8 views
Skip to first unread message

Bram Moolenaar

unread,
May 17, 2019, 5:09:31 AM5/17/19
to vim...@googlegroups.com

Patch 8.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.
Files: src/textprop.c, src/testdir/test_textprop.vim


*** ../vim-8.1.1336/src/textprop.c 2019-05-15 22:45:33.956067651 +0200
--- src/textprop.c 2019-05-17 11:04:54.930395439 +0200
***************
*** 1075,1081 ****
++prevprop.ga_len;
}

! if (prop.tp_col + prop.tp_len >= skipped && ga_grow(&nextprop, 1) == OK)
{
p = ((textprop_T *)nextprop.ga_data) + nextprop.ga_len;
*p = prop;
--- 1075,1083 ----
++prevprop.ga_len;
}

! // 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;
*** ../vim-8.1.1336/src/testdir/test_textprop.vim 2019-05-15 22:45:33.956067651 +0200
--- src/testdir/test_textprop.vim 2019-05-17 11:06:53.442102403 +0200
***************
*** 316,331 ****
call assert_equal(expected, prop_list(2))
call DeletePropTypes()

! " split just after first prop, empty prop and 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
call assert_equal(expected, prop_list(2))
call DeletePropTypes()

--- 316,330 ----
call assert_equal(expected, prop_list(2))
call DeletePropTypes()

! " 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 = expected[1:1]
! let expected[0].col -= 4
call assert_equal(expected, prop_list(2))
call DeletePropTypes()

*** ../vim-8.1.1336/src/version.c 2019-05-16 22:24:52.407017760 +0200
--- src/version.c 2019-05-17 11:08:05.421997669 +0200
***************
*** 769,770 ****
--- 769,772 ----
{ /* Add new patch number below this line */
+ /**/
+ 1337,
/**/

--
This computer is so slow, it takes forever to execute and endless loop!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages