patch 8.1.2293: join adds trailing space when second line is empty
Problem: Join adds trailing space when second line is empty. (Brennan
Vincent)
Solution: Do not add a trailing space.
diff --git a/src/testdir/test_join.vim b/src/testdir/test_join.vim
index 78835b2..5801c2f 100644
--- a/src/testdir/test_join.vim
+++ b/src/testdir/test_join.vim
@@ -9,6 +9,27 @@
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