Patch 8.2.0018
Problem: :join does not add white space where it should. (Zdenek Dohnal)
Solution: Handle joining multiple lines propely.
Files: src/ops.c, src/testdir/test_join.vim
*** ../vim-8.2.0017/src/ops.c 2019-12-13 19:29:22.376873472 +0100
--- src/ops.c 2019-12-17 22:08:23.956928903 +0100
***************
*** 2001,2007 ****
{
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)
--- 2001,2007 ----
{
curr = skipwhite(curr);
if (*curr != NUL && *curr != ')'
! && sumsize != 0 && endcurr1 != TAB
&& (!has_format_option(FO_MBYTE_JOIN)
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
&& (!has_format_option(FO_MBYTE_JOIN2)
*** ../vim-8.2.0017/src/testdir/test_join.vim 2019-11-12 20:26:21.000000000 +0100
--- src/testdir/test_join.vim 2019-12-17 22:10:23.044487429 +0100
***************
*** 427,429 ****
--- 427,440 ----
call assert_equal(expected, getline(1, '$'))
close!
endfunc
+
+ func Test_join_lines()
+ new
+ call setline(1, ['a', 'b', '', 'c', 'd'])
+ %join
+ call assert_equal('a b c d', getline(1))
+ call setline(1, ['a', 'b', '', 'c', 'd'])
+ normal 5J
+ call assert_equal('a b c d', getline(1))
+ bwipe!
+ endfunc
*** ../vim-8.2.0017/src/version.c 2019-12-17 21:27:14.690319902 +0100
--- src/version.c 2019-12-17 22:10:40.236423761 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 18,
/**/
--
ZOOT: I'm afraid our life must seem very dull and quiet compared to yours.
We are but eightscore young blondes, all between sixteen and
nineteen-and-a-half, cut off in this castle, with no one to protect us.
Oooh. It is a lonely life ... bathing ... dressing ... undressing ...
making exciting underwear....
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// 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 ///