summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-17 22:10:58 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-17 22:10:58 +0100
commit91b65e49440e77222a65b6f868507453239f409b (patch)
tree4f01f1f4186e679cbf299ddaae53a70ceeab0417
parent6f345a1458df2db03fba7863492404e9dc8b817c (diff)
patch 8.2.0018: :join does not add white space where it shouldv8.2.0018
Problem: :join does not add white space where it should. (Zdenek Dohnal) Solution: Handle joining multiple lines propely.
-rw-r--r--src/ops.c2
-rw-r--r--src/testdir/test_join.vim11
-rw-r--r--src/version.c2
3 files changed, 14 insertions, 1 deletions
diff --git a/src/ops.c b/src/ops.c
index 2a625066c4..72ffd56bc9 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2001,7 +2001,7 @@ do_join(
{
curr = skipwhite(curr);
if (*curr != NUL && *curr != ')'
- && currsize != 0 && endcurr1 != TAB
+ && sumsize != 0 && endcurr1 != TAB
&& (!has_format_option(FO_MBYTE_JOIN)
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
&& (!has_format_option(FO_MBYTE_JOIN2)
diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim
index 5801c2f127..377edab1e9 100644
--- a/src/testdir/test_join.vim
+++ b/src/testdir/test_join.vim
@@ -427,3 +427,14 @@ int i = 7 /* foo *// 3
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
diff --git a/src/version.c b/src/version.c
index c11710a6b6..65924cd097 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 18,
+/**/
17,
/**/
16,