Bram Moolenaar | c1c023e | 2013-11-07 03:26:06 +0100 | [diff] [blame^] | 1 | Tests for 'undolevel' setting being global-local |
| 2 | |
| 3 | STARTTEST |
| 4 | :so small.vim |
| 5 | :set nocompatible viminfo+=nviminfo ul=5 |
| 6 | :fu! FillBuffer() |
| 7 | :for i in range(1,13) |
| 8 | :put=i |
| 9 | :exe "setg ul=" . &g:ul |
| 10 | :endfor |
| 11 | :endfu |
| 12 | :fu! UndoLevel() |
| 13 | :redir @a | setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |redir end |
| 14 | :$put a |
| 15 | :endfu |
| 16 | :new one |
| 17 | :0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' |
| 18 | :call FillBuffer() |
| 19 | :call feedkeys(":earlier 10\n", 't') |
| 20 | :call UndoLevel() |
| 21 | :%w! test.out |
| 22 | :new two |
| 23 | :0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' |
| 24 | :setlocal ul=2 |
| 25 | :call FillBuffer() |
| 26 | :call feedkeys(":earlier 10\n", 't') |
| 27 | :call UndoLevel() |
| 28 | :setlocal ul=10 |
| 29 | :call UndoLevel() |
| 30 | :%w >> test.out |
| 31 | :wincmd p |
| 32 | :redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end |
| 33 | :new three |
| 34 | :setglobal ul=50 |
| 35 | :1put ='global value should be changed to 50' |
| 36 | :2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' |
| 37 | :call UndoLevel() |
| 38 | :%w >> test.out |
| 39 | :"sleep 10 |
| 40 | :qa! |
| 41 | ENDTEST |
| 42 | |