summaryrefslogtreecommitdiff
path: root/src/testdir/test_undo.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-01-07 16:14:57 +0100
committerBram Moolenaar <Bram@vim.org>2017-01-07 16:14:57 +0100
commitcbd4de44e8d08fba3c09eb40ad6e36e83faf020a (patch)
treea27001fc4d918b90c8ce7c3c5eb07cefef1b689c /src/testdir/test_undo.vim
parentc6aa475a27e3ed1645446b014c32ebf68d005d49 (diff)
downloadvim-cbd4de44e8d08fba3c09eb40ad6e36e83faf020a.zip
patch 8.0.0149: :earlier does not work after reading the undo file
Problem: ":earlier" and ":later" do not work after startup or reading the undo file. Solution: Use absolute time stamps instead of relative to the Vim start time. (Christian Brabandt, Pavel Juhas, closes #1300, closes #1254)
Diffstat (limited to 'src/testdir/test_undo.vim')
-rw-r--r--src/testdir/test_undo.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/testdir/test_undo.vim b/src/testdir/test_undo.vim
index fb1cdc836..f2ac6a8ea 100644
--- a/src/testdir/test_undo.vim
+++ b/src/testdir/test_undo.vim
@@ -235,3 +235,31 @@ func Test_insert_expr()
close!
endfunc
+
+func Test_undofile_earlier()
+ " Issue #1254
+ " create undofile with timestamps older than Vim startup time.
+ let t0 = localtime() - 43200
+ call test_settime(t0)
+ new Xfile
+ call feedkeys("ione\<Esc>", 'xt')
+ set ul=100
+ call test_settime(t0 + 1)
+ call feedkeys("otwo\<Esc>", 'xt')
+ set ul=100
+ call test_settime(t0 + 2)
+ call feedkeys("othree\<Esc>", 'xt')
+ set ul=100
+ w
+ wundo Xundofile
+ bwipe!
+ " restore normal timestamps.
+ call test_settime(0)
+ new Xfile
+ rundo Xundofile
+ earlier 1d
+ call assert_equal('', getline(1))
+ bwipe!
+ call delete('Xfile')
+ call delete('Xundofile')
+endfunc