mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
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.
This commit is contained in:
@@ -2001,7 +2001,7 @@ do_join(
|
|||||||
{
|
{
|
||||||
curr = skipwhite(curr);
|
curr = skipwhite(curr);
|
||||||
if (*curr != NUL && *curr != ')'
|
if (*curr != NUL && *curr != ')'
|
||||||
&& currsize != 0 && endcurr1 != TAB
|
&& sumsize != 0 && endcurr1 != TAB
|
||||||
&& (!has_format_option(FO_MBYTE_JOIN)
|
&& (!has_format_option(FO_MBYTE_JOIN)
|
||||||
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
|
|| (mb_ptr2char(curr) < 0x100 && endcurr1 < 0x100))
|
||||||
&& (!has_format_option(FO_MBYTE_JOIN2)
|
&& (!has_format_option(FO_MBYTE_JOIN2)
|
||||||
|
@@ -427,3 +427,14 @@ int i = 7 /* foo *// 3
|
|||||||
call assert_equal(expected, getline(1, '$'))
|
call assert_equal(expected, getline(1, '$'))
|
||||||
close!
|
close!
|
||||||
endfunc
|
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
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
18,
|
||||||
/**/
|
/**/
|
||||||
17,
|
17,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user