Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
28535:f90b0ce8d15d | 28536:b6f2f545f8cc |
---|---|
55 | 55 |
56 call setline(1, ['foo', 'bar']) | 56 call setline(1, ['foo', 'bar']) |
57 call feedkeys('ggVG=', 'xt') | 57 call feedkeys('ggVG=', 'xt') |
58 call assert_equal(['foo', 'bar'], getline(1, 2)) | 58 call assert_equal(['foo', 'bar'], getline(1, 2)) |
59 close! | 59 close! |
60 endfunc | |
61 | |
62 " Test indent operator creating one undo entry | |
63 func Test_indent_operator_undo() | |
64 enew | |
65 call setline(1, range(12)->map('"\t" .. v:val')) | |
66 func FoldExpr() | |
67 let g:foldcount += 1 | |
68 return '=' | |
69 endfunc | |
70 set foldmethod=expr foldexpr=FoldExpr() | |
71 let g:foldcount = 0 | |
72 redraw | |
73 call assert_equal(12, g:foldcount) | |
74 normal gg=G | |
75 call assert_equal(24, g:foldcount) | |
76 undo | |
77 call assert_equal(38, g:foldcount) | |
78 | |
79 bwipe! | |
80 set foldmethod& foldexpr= | |
81 delfunc FoldExpr | |
82 unlet g:foldcount | |
60 endfunc | 83 endfunc |
61 | 84 |
62 " Test for shifting a line with a preprocessor directive ('#') | 85 " Test for shifting a line with a preprocessor directive ('#') |
63 func Test_preproc_indent() | 86 func Test_preproc_indent() |
64 new | 87 new |