Mercurial > vim
diff src/testdir/test_undo.vim @ 13134:c4b5ad2b3596 v8.0.1441
patch 8.0.1441: using ":undo 0" leaves undo in wrong state
commit https://github.com/vim/vim/commit/ce46d934af35d0f774be7f996001db03cf0b894a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 30 22:46:06 2018 +0100
patch 8.0.1441: using ":undo 0" leaves undo in wrong state
Problem: Using ":undo 0" leaves undo in wrong state.
Solution: Instead of searching for state 1 and go above, just use the start.
(Ozaki Kiichi, closes #2595)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 30 Jan 2018 23:00:06 +0100 |
parents | cfaa513efa3f |
children | 2941a86f8aaa |
line wrap: on
line diff
--- a/src/testdir/test_undo.vim +++ b/src/testdir/test_undo.vim @@ -359,3 +359,47 @@ func Test_undo_append() norm o quit endfunc + +func Test_undo_0() + new + set ul=100 + normal i1 + undo + normal i2 + undo + normal i3 + + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('3', getline(1)) + call assert_equal(3, d.seq_cur) + + undo 2 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('2', getline(1)) + call assert_equal(2, d.seq_cur) + + undo 1 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('1', getline(1)) + call assert_equal(1, d.seq_cur) + + bwipe! +endfunc