Mercurial > vim
changeset 18914:4c0b420e7327 v8.2.0018
patch 8.2.0018: :join does not add white space where it should
Commit: https://github.com/vim/vim/commit/91b65e49440e77222a65b6f868507453239f409b
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 17 22:10:58 2019 +0100
patch 8.2.0018: :join does not add white space where it should
Problem: :join does not add white space where it should. (Zdenek Dohnal)
Solution: Handle joining multiple lines propely.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 17 Dec 2019 22:15:04 +0100 |
parents | 35d2ab3c4ff6 |
children | 0a2d1ed58482 |
files | src/ops.c src/testdir/test_join.vim src/version.c |
diffstat | 3 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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