Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 1 | Tests for undo tree. |
| 2 | Since this script is sourced we need to explicitly break changes up in |
| 3 | undo-able pieces. Do that by setting 'undolevels'. |
Bram Moolenaar | 730cde9 | 2010-06-27 05:18:54 +0200 | [diff] [blame^] | 4 | Also tests :earlier and :later. |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 5 | |
| 6 | STARTTEST |
| 7 | :" Delete three characters and undo |
| 8 | Gx:set ul=100 |
| 9 | x:set ul=100 |
| 10 | x:.w! test.out |
| 11 | g-:.w >>test.out |
| 12 | g-:.w >>test.out |
| 13 | g-:.w >>test.out |
| 14 | g-:.w >>test.out |
| 15 | :" |
| 16 | :/^111/w >>test.out |
| 17 | :" Delete three other characters and go back in time step by step |
| 18 | $x:set ul=100 |
| 19 | x:set ul=100 |
| 20 | x:.w >>test.out |
| 21 | :sleep 1 |
| 22 | g-:.w >>test.out |
| 23 | g-:.w >>test.out |
| 24 | g-:.w >>test.out |
| 25 | g-:.w >>test.out |
| 26 | g-:.w >>test.out |
| 27 | g-:.w >>test.out |
| 28 | g-:.w >>test.out |
| 29 | g-:.w >>test.out |
| 30 | 10g+:.w >>test.out |
| 31 | :" |
| 32 | :/^222/w >>test.out |
| 33 | :" Delay for three seconds and go some seconds forward and backward |
Bram Moolenaar | fa1d140 | 2006-03-25 21:59:56 +0000 | [diff] [blame] | 34 | :sleep 2 |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 35 | Aa:set ul=100 |
| 36 | Ab:set ul=100 |
| 37 | Ac:set ul=100 |
| 38 | :.w >>test.out |
| 39 | :ear 1s |
| 40 | :.w >>test.out |
| 41 | :ear 3s |
| 42 | :.w >>test.out |
| 43 | :later 1s |
| 44 | :.w >>test.out |
| 45 | :later 1h |
| 46 | :.w >>test.out |
Bram Moolenaar | eb3593b | 2006-04-22 22:33:57 +0000 | [diff] [blame] | 47 | :" |
| 48 | :" test undojoin |
| 49 | Goaaaa:set ul=100 |
| 50 | obbbbu:.w >>test.out |
| 51 | obbbb:set ul=100 |
| 52 | :undojoin |
| 53 | occccu:.w >>test.out |
Bram Moolenaar | 730cde9 | 2010-06-27 05:18:54 +0200 | [diff] [blame^] | 54 | :e! Xtest |
| 55 | ione one one:set ul=100 |
| 56 | :w! |
| 57 | otwo:set ul=100 |
| 58 | otwo:set ul=100 |
| 59 | :w |
| 60 | othree:earlier 1f |
| 61 | :" expect "one one one\ntwo\ntwo" |
| 62 | :%yank a |
| 63 | :earlier 1f |
| 64 | :" expect "one one one" |
| 65 | :%yank b |
| 66 | :earlier 1f |
| 67 | :" expect empty line |
| 68 | :%yank c |
| 69 | :later 1f |
| 70 | :" expect "one one one" |
| 71 | :%yank d |
| 72 | :later 1f |
| 73 | :" expect "one one one\ntwo\ntwo" |
| 74 | :%yank e |
| 75 | :later 1f |
| 76 | :" expect "one one one\ntwo\ntwo\nthree" |
| 77 | ggO---:0put e |
| 78 | ggO---:0put d |
| 79 | ggO---:0put c |
| 80 | ggO---:0put b |
| 81 | ggO---:0put a |
| 82 | ggO---:w >>test.out |
Bram Moolenaar | 9d47f17 | 2006-03-15 23:03:01 +0000 | [diff] [blame] | 83 | :qa! |
| 84 | ENDTEST |
| 85 | |
| 86 | 1111 ----- |
| 87 | 2222 ----- |
| 88 | |
| 89 | 123456789 |