diff src/testdir/test_fold.vim @ 31762:b53ab3c3e0c9 v9.0.1213

patch 9.0.1213: adding a line below the last one does not expand fold Commit: https://github.com/vim/vim/commit/da3dd7d857ba4fb4bf408dedd1d9d6a2d5e2ae9f Author: Brandon Simmons <simmsbra@gmail.com> Date: Tue Jan 17 19:48:07 2023 +0000 patch 9.0.1213: adding a line below the last one does not expand fold Problem: Adding a line below the last one does not expand fold. Solution: Do not skip mark_adjust() when adding lines below the last one. (Brandon Simmons, closes #11832, closes #10698)
author Bram Moolenaar <Bram@vim.org>
date Tue, 17 Jan 2023 21:00:05 +0100
parents 07480c2f5ea8
children 5614e76f3dee
line wrap: on
line diff
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -1683,4 +1683,17 @@ func Test_indent_with_L_command()
   bwipe!
 endfunc
 
+" Make sure that when there is a fold at the bottom of the buffer and a newline
+" character is appended to the line, the fold gets expanded (instead of the new
+" line not being part of the fold).
+func Test_expand_fold_at_bottom_of_buffer()
+  new
+  " create a fold on the only line
+  fold
+  execute "normal A\<CR>"
+  call assert_equal([1, 1], range(1, 2)->map('foldlevel(v:val)'))
+
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab