blob: dc24ab980443fd13140f03f5f6269c04d0f4e932 [file] [log] [blame]
Bram Moolenaar9d47f172006-03-15 23:03:01 +00001Tests for undo tree.
2Since this script is sourced we need to explicitly break changes up in
3undo-able pieces. Do that by setting 'undolevels'.
Bram Moolenaar730cde92010-06-27 05:18:54 +02004Also tests :earlier and :later.
Bram Moolenaar9d47f172006-03-15 23:03:01 +00005
6STARTTEST
Bram Moolenaar217d2852010-09-14 12:47:37 +02007:echo undotree().entries
8ENDTEST
9
10STARTTEST
Bram Moolenaar9d47f172006-03-15 23:03:01 +000011:" Delete three characters and undo
12Gx:set ul=100
13x:set ul=100
14x:.w! test.out
15g-:.w >>test.out
16g-:.w >>test.out
17g-:.w >>test.out
18g-:.w >>test.out
19:"
20:/^111/w >>test.out
21:" Delete three other characters and go back in time step by step
22$x:set ul=100
23x:set ul=100
24x:.w >>test.out
25:sleep 1
26g-:.w >>test.out
27g-:.w >>test.out
28g-:.w >>test.out
29g-:.w >>test.out
30g-:.w >>test.out
31g-:.w >>test.out
32g-:.w >>test.out
33g-:.w >>test.out
3410g+:.w >>test.out
35:"
36:/^222/w >>test.out
37:" Delay for three seconds and go some seconds forward and backward
Bram Moolenaarfa1d1402006-03-25 21:59:56 +000038:sleep 2
Bram Moolenaar9d47f172006-03-15 23:03:01 +000039Aa:set ul=100
40Ab:set ul=100
41Ac:set ul=100
42:.w >>test.out
43:ear 1s
44:.w >>test.out
45:ear 3s
46:.w >>test.out
47:later 1s
48:.w >>test.out
49:later 1h
50:.w >>test.out
Bram Moolenaareb3593b2006-04-22 22:33:57 +000051:"
52:" test undojoin
53Goaaaa:set ul=100
54obbbbu:.w >>test.out
55obbbb:set ul=100
56:undojoin
57occccu:.w >>test.out
Bram Moolenaar730cde92010-06-27 05:18:54 +020058:e! Xtest
59ione one one:set ul=100
60:w!
61otwo:set ul=100
62otwo:set ul=100
63:w
64othree:earlier 1f
65:" expect "one one one\ntwo\ntwo"
66:%yank a
67:earlier 1f
68:" expect "one one one"
69:%yank b
70:earlier 1f
71:" expect empty line
72:%yank c
73:later 1f
74:" expect "one one one"
75:%yank d
76:later 1f
77:" expect "one one one\ntwo\ntwo"
78:%yank e
79:later 1f
80:" expect "one one one\ntwo\ntwo\nthree"
81ggO---:0put e
82ggO---:0put d
83ggO---:0put c
84ggO---:0put b
85ggO---:0put a
86ggO---:w >>test.out
Bram Moolenaardf9259a2013-06-15 17:54:43 +020087:so small.vim
Bram Moolenaar9b846cb2013-06-26 21:56:36 +020088:set nocp viminfo+=nviminfo
Bram Moolenaardf9259a2013-06-15 17:54:43 +020089:enew!
90oa
91:set ul=100
92ob
93:set ul=100
94o1a2=setline('.','1234')
95
Bram Moolenaar3c1e9c22013-07-04 20:25:41 +020096uu:"
97oc
98:set ul=100
99o1a2=setline('.','1234')
100
101u:"
102od
103:set ul=100
104o1a2=string(123)
105u:"
106:%w >>test.out
Bram Moolenaar9d47f172006-03-15 23:03:01 +0000107:qa!
108ENDTEST
109
1101111 -----
1112222 -----
112
113123456789