Bram Moolenaar | 9750bb1 | 2012-12-05 16:10:42 +0100 | [diff] [blame] | 1 | vim: set ft=vim |
| 2 | |
| 3 | Tests for correct display (cursor column position) with +conceal and |
| 4 | tabulators. |
| 5 | |
| 6 | STARTTEST |
| 7 | :so small.vim |
| 8 | :if !has('conceal') |
| 9 | e! test.ok |
| 10 | wq! test.out |
| 11 | :endif |
| 12 | :" Conceal settings. |
| 13 | :set conceallevel=2 |
| 14 | :set concealcursor=nc |
| 15 | :syntax match test /|/ conceal |
| 16 | :" Save current cursor position. Only works in <expr> mode, can't be used |
| 17 | :" with :normal because it moves the cursor to the command line. Thanks to ZyX |
| 18 | :" <zyx.vim@gmail.com> for the idea to use an <expr> mapping. |
| 19 | :let positions = [] |
| 20 | :nnoremap <expr> GG ":let positions += ['".screenrow().":".screencol()."']\n" |
| 21 | :" Start test. |
| 22 | /^start: |
| 23 | :normal ztj |
| 24 | GGk |
| 25 | :" We should end up in the same column when running these commands on the two |
| 26 | :" lines. |
| 27 | :normal ft |
| 28 | GGk |
| 29 | :normal $ |
| 30 | GGk |
| 31 | :normal 0j |
| 32 | GGk |
| 33 | :normal ft |
| 34 | GGk |
| 35 | :normal $ |
| 36 | GGk |
| 37 | :normal 0j0j |
| 38 | GGk |
| 39 | :" Same for next test block. |
| 40 | :normal ft |
| 41 | GGk |
| 42 | :normal $ |
| 43 | GGk |
| 44 | :normal 0j |
| 45 | GGk |
| 46 | :normal ft |
| 47 | GGk |
| 48 | :normal $ |
| 49 | GGk |
| 50 | :normal 0j0j |
| 51 | GGk |
| 52 | :" And check W with multiple tabs and conceals in a line. |
| 53 | :normal W |
| 54 | GGk |
| 55 | :normal W |
| 56 | GGk |
| 57 | :normal W |
| 58 | GGk |
| 59 | :normal $ |
| 60 | GGk |
| 61 | :normal 0j |
| 62 | GGk |
| 63 | :normal W |
| 64 | GGk |
| 65 | :normal W |
| 66 | GGk |
| 67 | :normal W |
| 68 | GGk |
| 69 | :normal $ |
| 70 | GGk |
Bram Moolenaar | 3ff9b18 | 2013-07-13 12:36:55 +0200 | [diff] [blame] | 71 | :set lbr |
| 72 | :normal $ |
| 73 | GGk |
Bram Moolenaar | 8fc6bc7 | 2015-02-17 17:26:10 +0100 | [diff] [blame^] | 74 | :set list listchars=tab:>- |
| 75 | :normal 0 |
| 76 | GGk |
| 77 | :normal W |
| 78 | GGk |
| 79 | :normal W |
| 80 | GGk |
| 81 | :normal W |
| 82 | GGk |
| 83 | :normal $ |
| 84 | GGk |
Bram Moolenaar | 9750bb1 | 2012-12-05 16:10:42 +0100 | [diff] [blame] | 85 | :" Display result. |
| 86 | :call append('$', 'end:') |
| 87 | :call append('$', positions) |
| 88 | :/^end/,$wq! test.out |
| 89 | ENDTEST |
| 90 | |
| 91 | start: |
| 92 | .concealed. text |
| 93 | |concealed| text |
| 94 | |
| 95 | .concealed. text |
| 96 | |concealed| text |
| 97 | |
| 98 | .a. .b. .c. .d. |
| 99 | |a| |b| |c| |d| |