aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-20 21:24:30 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-20 21:48:08 -0400
commit66ed6297b0f5b6e571f675840388e0956c5deb9d (patch)
treefcbe2f7ae99e3225d433eb2320e6974725baa004 /src/nvim/testdir
parent0839c442574cc6f272bee53d350c0d155b74894a (diff)
downloadrneovim-66ed6297b0f5b6e571f675840388e0956c5deb9d.tar.gz
rneovim-66ed6297b0f5b6e571f675840388e0956c5deb9d.tar.bz2
rneovim-66ed6297b0f5b6e571f675840388e0956c5deb9d.zip
vim-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 vim/vim#2595) https://github.com/vim/vim/commit/ce46d934af35d0f774be7f996001db03cf0b894a
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_undo.vim44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim
index f31499607b..83ede1dc37 100644
--- a/src/nvim/testdir/test_undo.vim
+++ b/src/nvim/testdir/test_undo.vim
@@ -390,3 +390,47 @@ funct Test_undofile()
set undodir&
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