diff src/testdir/test_join.vim @ 18599:9cbdd58eeeb2 v8.1.2293

patch 8.1.2293: join adds trailing space when second line is empty Commit: https://github.com/vim/vim/commit/cc184cfb09161b3bbc7d5d8859a18e812367d19c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 12 20:31:20 2019 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 12 Nov 2019 20:45:04 +0100
parents 6990c1160ea5
children 4c0b420e7327
line wrap: on
line diff
--- a/src/testdir/test_join.vim
+++ b/src/testdir/test_join.vim
@@ -9,6 +9,27 @@ func Test_join_with_count()
   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