aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-20 08:16:41 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-04-21 07:24:50 +0800
commitf8b832b171d95aa3fb8e97a013d4a5717ff593c1 (patch)
treedc0ef2b3b6afff4e3365bfe554f244b63ebc5ace /src/nvim/testdir
parentc72857d396f03fb570a3df4fa1abd074974f0c76 (diff)
downloadrneovim-f8b832b171d95aa3fb8e97a013d4a5717ff593c1.tar.gz
rneovim-f8b832b171d95aa3fb8e97a013d4a5717ff593c1.tar.bz2
rneovim-f8b832b171d95aa3fb8e97a013d4a5717ff593c1.zip
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
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_indent.vim23
1 files changed, 23 insertions, 0 deletions
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