summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-01-30 22:46:06 +0100
committerBram Moolenaar <Bram@vim.org>2018-01-30 22:46:06 +0100
commitce46d934af35d0f774be7f996001db03cf0b894a (patch)
tree1145362d6a0ddfe22acf17aac1f34fcc2c3eda1f /src/testdir
parentb50773c6df0bc2c9c2ab1afecc78083abc606de0 (diff)
downloadvim-git-ce46d934af35d0f774be7f996001db03cf0b894a.tar.gz
patch 8.0.1441: using ":undo 0" leaves undo in wrong statev8.0.1441
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)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_undo.vim44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim
index b7235867b..cc3cceb1a 100644
--- 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