comparison src/testdir/view_util.vim @ 30687:f936d46cc9c1 v9.0.0678

patch 9.0.0678: using exclamation marks on :function Commit: https://github.com/vim/vim/commit/97f0eb169bf805c372b13c6bc9a03da2e75e3354 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 6 19:49:13 2022 +0100 patch 9.0.0678: using exclamation marks on :function Problem: Using exclamation marks on :function. Solution: Use :func and :endfunc as usual.
author Bram Moolenaar <Bram@vim.org>
date Thu, 06 Oct 2022 21:00:04 +0200
parents 851a014dfd8b
children a864e75257dd
comparison
equal deleted inserted replaced
30686:08d086d76489 30687:f936d46cc9c1
17 endfunc 17 endfunc
18 18
19 " Get text on the screen, including composing characters. 19 " Get text on the screen, including composing characters.
20 " ScreenLines(lnum, width) or 20 " ScreenLines(lnum, width) or
21 " ScreenLines([start, end], width) 21 " ScreenLines([start, end], width)
22 function! ScreenLines(lnum, width) abort 22 func ScreenLines(lnum, width) abort
23 redraw! 23 redraw!
24 if type(a:lnum) == v:t_list 24 if type(a:lnum) == v:t_list
25 let start = a:lnum[0] 25 let start = a:lnum[0]
26 let end = a:lnum[1] 26 let end = a:lnum[1]
27 else 27 else
31 let lines = [] 31 let lines = []
32 for l in range(start, end) 32 for l in range(start, end)
33 let lines += [join(map(range(1, a:width), 'screenstring(l, v:val)'), '')] 33 let lines += [join(map(range(1, a:width), 'screenstring(l, v:val)'), '')]
34 endfor 34 endfor
35 return lines 35 return lines
36 endfunction 36 endfunc
37 37
38 function! ScreenAttrs(lnum, width) abort 38 func ScreenAttrs(lnum, width) abort
39 redraw! 39 redraw!
40 if type(a:lnum) == v:t_list 40 if type(a:lnum) == v:t_list
41 let start = a:lnum[0] 41 let start = a:lnum[0]
42 let end = a:lnum[1] 42 let end = a:lnum[1]
43 else 43 else
47 let attrs = [] 47 let attrs = []
48 for l in range(start, end) 48 for l in range(start, end)
49 let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')] 49 let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')]
50 endfor 50 endfor
51 return attrs 51 return attrs
52 endfunction 52 endfunc
53 53
54 function! NewWindow(height, width) abort 54 func NewWindow(height, width) abort
55 exe a:height . 'new' 55 exe a:height . 'new'
56 exe a:width . 'vsp' 56 exe a:width . 'vsp'
57 set winfixwidth winfixheight 57 set winfixwidth winfixheight
58 redraw! 58 redraw!
59 endfunction 59 endfunc
60 60
61 function! CloseWindow() abort 61 func CloseWindow() abort
62 bw! 62 bw!
63 redraw! 63 redraw!
64 endfunction 64 endfunc