view src/testdir/test61.in @ 9037:d07035f84f0d v7.4.1804

commit https://github.com/vim/vim/commit/b20545f2a718d4f19c3f609fd11c0ca4eff450ce Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 30 14:15:54 2016 +0200 patch 7.4.1804 Problem: Can't use Vim as MANPAGER. Solution: Add manpager.vim. (Enno Nagel, closes https://github.com/vim/vim/issues/491)
author Christian Brabandt <cb@256bit.org>
date Sat, 30 Apr 2016 14:30:05 +0200
parents bc269cf15ccd
children
line wrap: on
line source

Tests for undo tree.
Since this script is sourced we need to explicitly break changes up in
undo-able pieces.  Do that by setting 'undolevels'.
Also tests :earlier and :later.

STARTTEST
:echo undotree().entries
ENDTEST

STARTTEST
:" Delete three characters and undo
Gx:set ul=100
x:set ul=100
x:.w! test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
:"
:/^111/w >>test.out
:" Delete three other characters and go back in time step by step
$x:set ul=100
x:set ul=100
x:.w >>test.out
:sleep 1
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
g-:.w >>test.out
10g+:.w >>test.out
:"
:/^222/w >>test.out
:" Delay for three seconds and go some seconds forward and backward
:sleep 2
Aa:set ul=100
Ab:set ul=100
Ac:set ul=100
:.w >>test.out
:ear 1s
:.w >>test.out
:ear 3s
:.w >>test.out
:later 1s
:.w >>test.out
:later 1h
:.w >>test.out
:"
:" test undojoin
Goaaaa:set ul=100
obbbbu:.w >>test.out
obbbb:set ul=100
:undojoin
occccu:.w >>test.out
:e! Xtest
ione one one:set ul=100
:w!
otwo:set ul=100
otwo:set ul=100
:w
othree:earlier 1f
:" expect "one one one\ntwo\ntwo"
:%yank a
:earlier 1f
:" expect "one one one"
:%yank b
:earlier 1f
:" expect empty line
:%yank c
:later 1f
:" expect "one one one"
:%yank d
:later 1f
:" expect "one one one\ntwo\ntwo"
:%yank e
:later 1f
:" expect "one one one\ntwo\ntwo\nthree"
ggO---:0put e
ggO---:0put d
ggO---:0put c
ggO---:0put b
ggO---:0put a
ggO---:w >>test.out
:so small.vim
:set nocp viminfo+=nviminfo
:enew!
oa:
:set ul=100
ob:
:set ul=100
o1a2=setline('.','1234')

uu:"
oc:
:set ul=100
o1a2=setline('.','1234')

u:"
od:
:set ul=100
o1a2=string(123)
u:"
:%w >>test.out
:qa!
ENDTEST

1111 -----
2222 -----

123456789