Mercurial > vim
annotate src/testdir/test_undo.vim @ 12614:12f4408c7f69 v8.0.1185
patch 8.0.1185: Ruby library includes minor version number
commit https://github.com/vim/vim/commit/9202162c5c069c925b6b9bf84e546fbd362cdf46
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 12 12:33:43 2017 +0200
patch 8.0.1185: Ruby library includes minor version number
Problem: Ruby library includes minor version number.
Solution: Only use the API version number. (Ben Boeckel, closes https://github.com/vim/vim/issues/2199)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 12 Oct 2017 12:45:07 +0200 |
parents | ae45d497868f |
children | 1fad9675d8fd |
rev | line source |
---|---|
9674
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for the undo tree. |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 " Since this script is sourced we need to explicitly break changes up in |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 " undo-able pieces. Do that by setting 'undolevels'. |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 " Also tests :earlier and :later. |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
11091
ae45d497868f
patch 8.0.0433: beeps when running tests
Christian Brabandt <cb@256bit.org>
parents:
10631
diff
changeset
|
6 set belloff=all |
9674
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 func Test_undotree() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 exe "normal Aabc\<Esc>" |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 exe "normal Adef\<Esc>" |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 undo |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let d = undotree() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_true(d.seq_last > 0) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_true(d.seq_cur > 0) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_true(d.seq_cur < d.seq_last) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_true(len(d.entries) > 0) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " TODO: check more members of d |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 w! Xtest |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal(d.save_last + 1, undotree().save_last) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call delete('Xtest') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 bwipe Xtest |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 func FillBuffer() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 for i in range(1,13) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 put=i |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 " Set 'undolevels' to split undo. |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 exe "setg ul=" . &g:ul |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 endfor |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 func Test_global_local_undolevels() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 new one |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 set undolevels=5 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call FillBuffer() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 " will only undo the last 5 changes, end up with 13 - (5 + 1) = 7 lines |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 earlier 10 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal(5, &g:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call assert_equal(-123456, &l:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call assert_equal('7', getline('$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 new two |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 setlocal undolevels=2 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call FillBuffer() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " will only undo the last 2 changes, end up with 13 - (2 + 1) = 10 lines |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 earlier 10 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call assert_equal(5, &g:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call assert_equal(2, &l:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal('10', getline('$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 setlocal ul=10 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 call assert_equal(5, &g:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 call assert_equal(10, &l:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 " Setting local value in "two" must not change local value in "one" |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 wincmd p |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(5, &g:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call assert_equal(-123456, &l:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 new three |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 setglobal ul=50 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal(50, &g:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_equal(-123456, &l:undolevels) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 " Drop created windows |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 set ul& |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 new |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 only! |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 func BackOne(expected) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call feedkeys('g-', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 call assert_equal(a:expected, getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 func Test_undo_del_chars() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 " Setup a buffer without creating undo entries |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 new |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 set ul=-1 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call setline(1, ['123-456']) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 1 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call test_settime(100) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 " Delete three characters and undo with g- |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 call feedkeys('x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call feedkeys('x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call feedkeys('x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call assert_equal('-456', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 call BackOne('3-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 call BackOne('23-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call BackOne('123-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_fails("BackOne('123-456')") |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 :" Delete three other characters and go back in time with g- |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call feedkeys('$x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 call feedkeys('x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call feedkeys('x', 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 call assert_equal('123-', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call test_settime(101) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 call BackOne('123-4') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 call BackOne('123-45') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 " skips '123-456' because it's older |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 call BackOne('-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 call BackOne('3-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 call BackOne('23-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 call BackOne('123-456') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 call assert_fails("BackOne('123-456')") |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 normal 10g+ |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call assert_equal('123-', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 :" Jump two seconds and go some seconds forward and backward |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 call test_settime(103) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call feedkeys("Aa\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call feedkeys("Ab\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call feedkeys("Ac\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 call assert_equal('123-abc', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 earlier 1s |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 call assert_equal('123-', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 earlier 3s |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 call assert_equal('123-456', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 later 1s |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 call assert_equal('123-', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 later 1h |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 call assert_equal('123-abc', getline(1)) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 close! |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 |
10049
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
133 func Test_undolist() |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
134 new |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
135 set ul=100 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
136 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
137 let a=execute('undolist') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
138 call assert_equal("\nNothing to undo", a) |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
139 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
140 " 1 leaf (2 changes). |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
141 call feedkeys('achange1', 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
142 call feedkeys('achange2', 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
143 let a=execute('undolist') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
144 call assert_match("^\nnumber changes when *saved\n *2 *2 .*$", a) |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
145 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
146 " 2 leaves. |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
147 call feedkeys('u', 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
148 call feedkeys('achange3\<Esc>', 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
149 let a=execute('undolist') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
150 call assert_match("^\nnumber changes when *saved\n *2 *2 *.*\n *3 *2 .*$", a) |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
151 close! |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
152 endfunc |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
153 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
154 func Test_U_command() |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
155 new |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
156 set ul=100 |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
157 call feedkeys("achange1\<Esc>", 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
158 call feedkeys("achange2\<Esc>", 'xt') |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
159 norm! U |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
160 call assert_equal('', getline(1)) |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
161 norm! U |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
162 call assert_equal('change1change2', getline(1)) |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
163 close! |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
164 endfunc |
efc8a434f38f
commit https://github.com/vim/vim/commit/c628fdcd46e93c308f742efdf54248695960e290
Christian Brabandt <cb@256bit.org>
parents:
9674
diff
changeset
|
165 |
9674
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 func Test_undojoin() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 new |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 call feedkeys("Goaaaa\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 call feedkeys("obbbb\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call assert_equal(['aaaa', 'bbbb'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 call feedkeys("u", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 call assert_equal(['aaaa'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 call feedkeys("obbbb\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 undojoin |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 " Note: next change must not be as if typed |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 call feedkeys("occcc\<Esc>", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call assert_equal(['aaaa', 'bbbb', 'cccc'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 call feedkeys("u", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 call assert_equal(['aaaa'], getline(2, '$')) |
10631
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
180 bwipe! |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
181 endfunc |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
182 |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
183 func Test_undojoin_redo() |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
184 new |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
185 call setline(1, ['first line', 'second line']) |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
186 call feedkeys("ixx\<Esc>", 'xt') |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
187 call feedkeys(":undojoin | redo\<CR>", 'xt') |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
188 call assert_equal('xxfirst line', getline(1)) |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
189 call assert_equal('second line', getline(2)) |
cbf17371627c
patch 8.0.0205: wrong behavior after :undojoin
Christian Brabandt <cb@256bit.org>
parents:
10518
diff
changeset
|
190 bwipe! |
9674
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 func Test_undo_write() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 split Xtest |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 call feedkeys("ione one one\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 w! |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 call feedkeys("otwo\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 call feedkeys("otwo\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 w |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 call feedkeys("othree\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 call assert_equal(['one one one', 'two', 'two', 'three'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 earlier 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 call assert_equal(['one one one', 'two', 'two'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 earlier 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call assert_equal(['one one one'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 earlier 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 call assert_equal([''], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 later 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 call assert_equal(['one one one'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 later 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 call assert_equal(['one one one', 'two', 'two'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 later 1f |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 call assert_equal(['one one one', 'two', 'two', 'three'], getline(1, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 close! |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 call delete('Xtest') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 bwipe! Xtest |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 endfunc |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 func Test_insert_expr() |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 new |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 " calling setline() triggers undo sync |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 call feedkeys("oa\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 call feedkeys("ob\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 call feedkeys("o1\<Esc>a2\<C-R>=setline('.','1234')\<CR>\<CR>\<Esc>", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 call assert_equal(['a', 'b', '120', '34'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 call feedkeys("u", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 call assert_equal(['a', 'b', '12'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 call feedkeys("u", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 call assert_equal(['a', 'b'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 call feedkeys("oc\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 call feedkeys("o1\<Esc>a2\<C-R>=setline('.','1234')\<CR>\<CR>\<Esc>", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 call assert_equal(['a', 'b', 'c', '120', '34'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 call feedkeys("u", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 call assert_equal(['a', 'b', 'c', '12'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 call feedkeys("od\<Esc>", 'xt') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 set ul=100 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 call feedkeys("o1\<Esc>a2\<C-R>=string(123)\<CR>\<Esc>", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 call assert_equal(['a', 'b', 'c', '12', 'd', '12123'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 call feedkeys("u", 'x') |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
245 call assert_equal(['a', 'b', 'c', '12', 'd'], getline(2, '$')) |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
246 |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
247 close! |
adc7212951ee
commit https://github.com/vim/vim/commit/170b10b421f0c9fda08b7cfd3bb043c064f3659a
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 endfunc |
10518
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
249 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
250 func Test_undofile_earlier() |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
251 " Issue #1254 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
252 " create undofile with timestamps older than Vim startup time. |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
253 let t0 = localtime() - 43200 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
254 call test_settime(t0) |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
255 new Xfile |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
256 call feedkeys("ione\<Esc>", 'xt') |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
257 set ul=100 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
258 call test_settime(t0 + 1) |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
259 call feedkeys("otwo\<Esc>", 'xt') |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
260 set ul=100 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
261 call test_settime(t0 + 2) |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
262 call feedkeys("othree\<Esc>", 'xt') |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
263 set ul=100 |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
264 w |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
265 wundo Xundofile |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
266 bwipe! |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
267 " restore normal timestamps. |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
268 call test_settime(0) |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
269 new Xfile |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
270 rundo Xundofile |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
271 earlier 1d |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
272 call assert_equal('', getline(1)) |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
273 bwipe! |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
274 call delete('Xfile') |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
275 call delete('Xundofile') |
de77fa909414
commit https://github.com/vim/vim/commit/cbd4de44e8d08fba3c09eb40ad6e36e83faf020a
Christian Brabandt <cb@256bit.org>
parents:
10049
diff
changeset
|
276 endfunc |