Patch 8.2.3952
Problem:    First line not redrawn when adding lines to an empty buffer.
Solution:   Adjust the argument to appended_lines(). (closes #9439,
            closes #9438)
Files:      src/ex_cmds.c, src/testdir/test_excmd.vim


*** ../vim-8.2.3951/src/ex_cmds.c       2021-12-27 17:21:38.004449137 +0000
--- src/ex_cmds.c       2021-12-31 12:18:39.495787578 +0000
***************
*** 3359,3365 ****
  
        did_undo = TRUE;
        ml_append(lnum, theline, (colnr_T)0, FALSE);
!       appended_lines_mark(lnum + (empty ? 1 : 0), 1L);
  
        vim_free(theline);
        ++lnum;
--- 3359,3369 ----
  
        did_undo = TRUE;
        ml_append(lnum, theline, (colnr_T)0, FALSE);
!       if (empty)
!           // there are no marks below the inserted lines
!           appended_lines(lnum, 1L);
!       else
!           appended_lines_mark(lnum, 1L);
  
        vim_free(theline);
        ++lnum;
*** ../vim-8.2.3951/src/testdir/test_excmd.vim  2021-11-24 12:17:49.168449919 
+0000
--- src/testdir/test_excmd.vim  2021-12-31 12:12:18.319592972 +0000
***************
*** 1,6 ****
--- 1,8 ----
  " Tests for various Ex commands.
  
  source check.vim
+ source shared.vim
+ source term_util.vim
  
  func Test_ex_delete()
    new
***************
*** 128,133 ****
--- 130,156 ----
    close!
  endfunc
  
+ func Test_append_cmd_empty_buf()
+   CheckRunVimInTerminal
+   let lines =<< trim END
+     func Timer(timer)
+       append
+     aaaaa
+     bbbbb
+     .
+     endfunc
+     call timer_start(10, 'Timer')
+   END
+   call writefile(lines, 'Xtest_append_cmd_empty_buf')
+   let buf = RunVimInTerminal('-S Xtest_append_cmd_empty_buf', {'rows': 6})
+   call WaitForAssert({-> assert_equal('bbbbb', term_getline(buf, 2))})
+   call WaitForAssert({-> assert_equal('aaaaa', term_getline(buf, 1))})
+ 
+   " clean up
+   call StopVimInTerminal(buf)
+   call delete('Xtest_append_cmd_empty_buf')
+ endfunc
+ 
  " Test for the :insert command
  func Test_insert_cmd()
    new
***************
*** 156,161 ****
--- 179,205 ----
    close!
  endfunc
  
+ func Test_insert_cmd_empty_buf()
+   CheckRunVimInTerminal
+   let lines =<< trim END
+     func Timer(timer)
+       insert
+     aaaaa
+     bbbbb
+     .
+     endfunc
+     call timer_start(10, 'Timer')
+   END
+   call writefile(lines, 'Xtest_insert_cmd_empty_buf')
+   let buf = RunVimInTerminal('-S Xtest_insert_cmd_empty_buf', {'rows': 6})
+   call WaitForAssert({-> assert_equal('bbbbb', term_getline(buf, 2))})
+   call WaitForAssert({-> assert_equal('aaaaa', term_getline(buf, 1))})
+ 
+   " clean up
+   call StopVimInTerminal(buf)
+   call delete('Xtest_insert_cmd_empty_buf')
+ endfunc
+ 
  " Test for the :change command
  func Test_change_cmd()
    new
*** ../vim-8.2.3951/src/version.c       2021-12-30 17:09:01.491005356 +0000
--- src/version.c       2021-12-31 12:14:11.039690103 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3952,
  /**/

-- 
Microsoft says that MS-Windows is much better for you than Linux.
That's like the Pope saying that catholicism is much better for
you than protestantism.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20211231122104.39A961C0A5B%40moolenaar.net.

Raspunde prin e-mail lui