Patch 8.1.2293
Problem: Join adds trailing space when second line is empty. (Brennan
Vincent)
Solution: Do not add a trailing space.
Files: src/ops.c, src/testdir/test_join.vim
*** ../vim-8.1.2292/src/ops.c 2019-11-09 23:26:36.905570965 +0100
--- src/ops.c 2019-11-12 20:26:44.877284961 +0100
***************
*** 1999,2005 ****
if (insert_space && t > 0)
{
curr = skipwhite(curr);
! if (*curr != ')' && currsize != 0 && endcurr1 != TAB
&& (!has_format_option(FO_MBYTE_JOIN)
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
&& (!has_format_option(FO_MBYTE_JOIN2)
--- 1999,2006 ----
if (insert_space && t > 0)
{
curr = skipwhite(curr);
! if (*curr != NUL && *curr != ')'
! && currsize != 0 && endcurr1 != TAB
&& (!has_format_option(FO_MBYTE_JOIN)
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
&& (!has_format_option(FO_MBYTE_JOIN2)
*** ../vim-8.1.2292/src/testdir/test_join.vim 2019-06-24 00:58:02.908020514 +0200
--- src/testdir/test_join.vim 2019-11-12 20:26:21.889312699 +0100
***************
*** 9,14 ****
--- 9,35 ----
call setline(1, ['one', 'two', 'three', 'four'])
normal 10J
call assert_equal('one two three four', getline(1))
+
+ call setline(1, ['one', '', 'two'])
+ normal J
+ call assert_equal('one', getline(1))
+
+ call setline(1, ['one', ' ', 'two'])
+ normal J
+ call assert_equal('one', getline(1))
+
+ call setline(1, ['one', '', '', 'two'])
+ normal JJ
+ call assert_equal('one', getline(1))
+
+ call setline(1, ['one', ' ', ' ', 'two'])
+ normal JJ
+ call assert_equal('one', getline(1))
+
+ call setline(1, ['one', '', '', 'two'])
+ normal 2J
+ call assert_equal('one', getline(1))
+
quit!
endfunc
*** ../vim-8.1.2292/src/version.c 2019-11-11 21:45:01.929407112 +0100
--- src/version.c 2019-11-12 20:31:07.964797262 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 2293,
/**/
--
hundred-and-one symptoms of being an internet addict:
79. All of your most erotic dreams have a scrollbar at the right side.
/// 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 ///