1
0
forked from aniani/vim

patch 9.0.0678: using exclamation marks on :function

Problem:    Using exclamation marks on :function.
Solution:   Use :func and :endfunc as usual.
This commit is contained in:
Bram Moolenaar
2022-10-06 19:49:13 +01:00
parent 06618f94f1
commit 97f0eb169b
7 changed files with 34 additions and 32 deletions

View File

@@ -48,7 +48,7 @@ endfunc
" delete it afterwards. However, if an exception is thrown the file may remain, " delete it afterwards. However, if an exception is thrown the file may remain,
" the caller should call DeleteTheScript() afterwards. " the caller should call DeleteTheScript() afterwards.
let s:script_name = '' let s:script_name = ''
function! ExecAsScript(funcname) func ExecAsScript(funcname)
" Make a script from the function passed as argument. " Make a script from the function passed as argument.
let s:script_name = MakeScript(a:funcname) let s:script_name = MakeScript(a:funcname)
@@ -56,9 +56,9 @@ function! ExecAsScript(funcname)
exec "source" s:script_name exec "source" s:script_name
call delete(s:script_name) call delete(s:script_name)
let s:script_name = '' let s:script_name = ''
endfunction endfunc
function! DeleteTheScript() func DeleteTheScript()
if s:script_name if s:script_name
call delete(s:script_name) call delete(s:script_name)
let s:script_name = '' let s:script_name = ''

View File

@@ -3,26 +3,26 @@
source check.vim source check.vim
source screendump.vim source screendump.vim
function! s:screen_attr(lnum) abort func s:screen_attr(lnum) abort
return map(range(1, 8), 'screenattr(a:lnum, v:val)') return map(range(1, 8), 'screenattr(a:lnum, v:val)')
endfunction endfunc
function! s:test_windows(h, w) abort func s:test_windows(h, w) abort
call NewWindow(a:h, a:w) call NewWindow(a:h, a:w)
endfunction endfunc
function! s:close_windows() abort func s:close_windows() abort
call CloseWindow() call CloseWindow()
endfunction endfunc
function! s:new_hi() abort func s:new_hi() abort
redir => save_hi redir => save_hi
silent! hi CursorLineNr silent! hi CursorLineNr
redir END redir END
let save_hi = join(split(substitute(save_hi, '\s*xxx\s*', ' ', ''), "\n"), '') let save_hi = join(split(substitute(save_hi, '\s*xxx\s*', ' ', ''), "\n"), '')
exe 'hi' save_hi 'ctermbg=0 guibg=Black' exe 'hi' save_hi 'ctermbg=0 guibg=Black'
return save_hi return save_hi
endfunction endfunc
func Test_cursorline_highlight1() func Test_cursorline_highlight1()
let save_hi = s:new_hi() let save_hi = s:new_hi()

View File

@@ -1152,11 +1152,11 @@ func Test_CompleteChanged()
bw! bw!
endfunc endfunc
function! GetPumPosition() func GetPumPosition()
call assert_true( pumvisible() ) call assert_true( pumvisible() )
let g:pum_pos = pum_getpos() let g:pum_pos = pum_getpos()
return '' return ''
endfunction endfunc
func Test_pum_getpos() func Test_pum_getpos()
new new

View File

@@ -220,7 +220,7 @@ func Test_prompt_buffer_getbufinfo()
%bwipe! %bwipe!
endfunc endfunc
function! Test_prompt_while_writing_to_hidden_buffer() func Test_prompt_while_writing_to_hidden_buffer()
call CanTestPromptBuffer() call CanTestPromptBuffer()
CheckUnix CheckUnix

View File

@@ -719,23 +719,23 @@ endfunc
XpathINIT XpathINIT
function! NULL() func NULL()
Xpath 'a' Xpath 'a'
return 0 return 0
endfunction endfunc
function! ZERO() func ZERO()
Xpath 'b' Xpath 'b'
return 0 return 0
endfunction endfunc
function! F0() func! F0()
Xpath 'c' Xpath 'c'
endfunction endfunc
function! F1(arg) func! F1(arg)
Xpath 'e' Xpath 'e'
endfunction endfunc
let V0 = 1 let V0 = 1
@@ -6822,10 +6822,10 @@ endfunc
" Test 95: lines of :append, :change, :insert {{{1 " Test 95: lines of :append, :change, :insert {{{1
"------------------------------------------------------------------------------- "-------------------------------------------------------------------------------
function! DefineFunction(name, body) func DefineFunction(name, body)
let func = join(['function! ' . a:name . '()'] + a:body + ['endfunction'], "\n") let func = join(['function! ' . a:name . '()'] + a:body + ['endfunction'], "\n")
exec func exec func
endfunction endfunc
func Test_script_lines() func Test_script_lines()
" :append " :append

View File

@@ -19,7 +19,7 @@ endfunc
" Get text on the screen, including composing characters. " Get text on the screen, including composing characters.
" ScreenLines(lnum, width) or " ScreenLines(lnum, width) or
" ScreenLines([start, end], width) " ScreenLines([start, end], width)
function! ScreenLines(lnum, width) abort func ScreenLines(lnum, width) abort
redraw! redraw!
if type(a:lnum) == v:t_list if type(a:lnum) == v:t_list
let start = a:lnum[0] let start = a:lnum[0]
@@ -33,9 +33,9 @@ function! ScreenLines(lnum, width) abort
let lines += [join(map(range(1, a:width), 'screenstring(l, v:val)'), '')] let lines += [join(map(range(1, a:width), 'screenstring(l, v:val)'), '')]
endfor endfor
return lines return lines
endfunction endfunc
function! ScreenAttrs(lnum, width) abort func ScreenAttrs(lnum, width) abort
redraw! redraw!
if type(a:lnum) == v:t_list if type(a:lnum) == v:t_list
let start = a:lnum[0] let start = a:lnum[0]
@@ -49,16 +49,16 @@ function! ScreenAttrs(lnum, width) abort
let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')] let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')]
endfor endfor
return attrs return attrs
endfunction endfunc
function! NewWindow(height, width) abort func NewWindow(height, width) abort
exe a:height . 'new' exe a:height . 'new'
exe a:width . 'vsp' exe a:width . 'vsp'
set winfixwidth winfixheight set winfixwidth winfixheight
redraw! redraw!
endfunction endfunc
function! CloseWindow() abort func CloseWindow() abort
bw! bw!
redraw! redraw!
endfunction endfunc

View File

@@ -699,6 +699,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
678,
/**/ /**/
677, 677,
/**/ /**/