diff src/testdir/test_indent.vim @ 28536:b6f2f545f8cc v8.2.4792

patch 8.2.4792: indent operator creates an undo entry for every line Commit: https://github.com/vim/vim/commit/e4686989944bffdbcf59890aa21091b135528618 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 19 18:28:45 2022 +0100 patch 8.2.4792: indent operator creates an undo entry for every line Problem: Indent operator creates an undo entry for every line. Solution: Create one undo entry for all lines. (closes https://github.com/vim/vim/issues/10227)
author Bram Moolenaar <Bram@vim.org>
date Tue, 19 Apr 2022 19:30:03 +0200
parents 748793fcb4e2
children a2c89e5446b7
line wrap: on
line diff
--- a/src/testdir/test_indent.vim
+++ b/src/testdir/test_indent.vim
@@ -59,6 +59,29 @@ func Test_reindent()
   close!
 endfunc
 
+" Test indent operator creating one undo entry
+func Test_indent_operator_undo()
+  enew
+  call setline(1, range(12)->map('"\t" .. v:val'))
+  func FoldExpr()
+    let g:foldcount += 1
+    return '='
+  endfunc
+  set foldmethod=expr foldexpr=FoldExpr()
+  let g:foldcount = 0
+  redraw
+  call assert_equal(12, g:foldcount)
+  normal gg=G
+  call assert_equal(24, g:foldcount)
+  undo
+  call assert_equal(38, g:foldcount)
+
+  bwipe!
+  set foldmethod& foldexpr=
+  delfunc FoldExpr
+  unlet g:foldcount
+endfunc
+
 " Test for shifting a line with a preprocessor directive ('#')
 func Test_preproc_indent()
   new