From f8b832b171d95aa3fb8e97a013d4a5717ff593c1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 20 Apr 2022 08:16:41 +0800 Subject: vim-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 vim/vim#10227) https://github.com/vim/vim/commit/e4686989944bffdbcf59890aa21091b135528618 --- src/nvim/testdir/test_indent.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_indent.vim b/src/nvim/testdir/test_indent.vim index 91e801a64a..516b3fbdd1 100644 --- a/src/nvim/testdir/test_indent.vim +++ b/src/nvim/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 -- cgit