Bram Moolenaar | 544d3bc | 2017-02-05 21:14:50 +0100 | [diff] [blame^] | 1 | " Functions about view shared by several tests |
| 2 | |
| 3 | " ScreenLines(lnum, width) or |
| 4 | " ScreenLines([start, end], width) |
| 5 | function! ScreenLines(lnum, width) abort |
| 6 | redraw! |
| 7 | if type(a:lnum) == v:t_list |
| 8 | let start = a:lnum[0] |
| 9 | let end = a:lnum[1] |
| 10 | else |
| 11 | let start = a:lnum |
| 12 | let end = a:lnum |
| 13 | endif |
| 14 | let lines = [] |
| 15 | for l in range(start, end) |
| 16 | let lines += [join(map(range(1, a:width), 'nr2char(screenchar(l, v:val))'), '')] |
| 17 | endfor |
| 18 | return lines |
| 19 | endfunction |
| 20 | |
| 21 | function! NewWindow(height, width) abort |
| 22 | exe a:height . 'new' |
| 23 | exe a:width . 'vsp' |
| 24 | redraw! |
| 25 | endfunction |
| 26 | |
| 27 | function! CloseWindow() abort |
| 28 | bw! |
| 29 | redraw! |
| 30 | endfunction |