mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 07:16:09 +00:00
Merge #7890 'vim-patch: various'
This commit is contained in:
@@ -16274,8 +16274,8 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
// get the conceal character
|
||||
if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) {
|
||||
cchar = syn_get_sub_char();
|
||||
if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) {
|
||||
cchar = lcs_conceal;
|
||||
if (cchar == NUL && curwin->w_p_cole == 1) {
|
||||
cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal;
|
||||
}
|
||||
if (cchar != NUL) {
|
||||
utf_char2bytes(cchar, str);
|
||||
@@ -20863,7 +20863,9 @@ void ex_delfunction(exarg_T *eap)
|
||||
|
||||
if (!eap->skip) {
|
||||
if (fp == NULL) {
|
||||
EMSG2(_(e_nofunc), eap->arg);
|
||||
if (!eap->forceit) {
|
||||
EMSG2(_(e_nofunc), eap->arg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (fp->uf_calls > 0) {
|
||||
|
@@ -692,7 +692,7 @@ return {
|
||||
},
|
||||
{
|
||||
command='delcommand',
|
||||
flags=bit.bor(NEEDARG, WORD1, TRLBAR, CMDWIN),
|
||||
flags=bit.bor(BANG, NEEDARG, WORD1, TRLBAR, CMDWIN),
|
||||
addr_type=ADDR_LINES,
|
||||
func='ex_delcommand',
|
||||
},
|
||||
|
@@ -1,5 +1,7 @@
|
||||
" Test for syntax and syntax iskeyword option
|
||||
|
||||
source view_util.vim
|
||||
|
||||
func GetSyntaxItem(pat)
|
||||
let c = ''
|
||||
let a = ['a', getreg('a'), getregtype('a')]
|
||||
@@ -340,3 +342,40 @@ func Test_invalid_name()
|
||||
hi clear Nop
|
||||
hi clear @Wrong
|
||||
endfunc
|
||||
|
||||
|
||||
func Test_conceal()
|
||||
if !has('conceal')
|
||||
return
|
||||
endif
|
||||
|
||||
new
|
||||
call setline(1, ['', '123456'])
|
||||
syn match test23 "23" conceal cchar=X
|
||||
syn match test45 "45" conceal
|
||||
|
||||
set conceallevel=0
|
||||
call assert_equal('123456 ', ScreenLines(2, 7)[0])
|
||||
call assert_equal([[0, ''], [0, ''], [0, ''], [0, ''], [0, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
||||
|
||||
set conceallevel=1
|
||||
call assert_equal('1X 6 ', ScreenLines(2, 7)[0])
|
||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ' '], [1, ' '], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
||||
|
||||
set conceallevel=1
|
||||
set listchars=conceal:Y
|
||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, 'Y'], [1, 'Y'], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
||||
call assert_equal('1XY6 ', ScreenLines(2, 7)[0])
|
||||
|
||||
set conceallevel=2
|
||||
call assert_match('1X6 ', ScreenLines(2, 7)[0])
|
||||
call assert_equal([[0, ''], [1, 'X'], [1, 'X'], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
||||
|
||||
set conceallevel=3
|
||||
call assert_match('16 ', ScreenLines(2, 7)[0])
|
||||
call assert_equal([[0, ''], [1, ''], [1, ''], [1, ''], [1, ''], [0, '']], map(range(1, 6), 'synconcealed(2, v:val)[0:1]'))
|
||||
|
||||
syn clear
|
||||
set conceallevel&
|
||||
bw!
|
||||
endfunc
|
||||
|
@@ -1215,6 +1215,62 @@ func Test_bitwise_functions()
|
||||
call assert_fails("call invert({})", 'E728:')
|
||||
endfunc
|
||||
|
||||
" Test trailing text after :endfunction {{{1
|
||||
func Test_endfunction_trailing()
|
||||
call assert_false(exists('*Xtest'))
|
||||
|
||||
exe "func Xtest()\necho 'hello'\nendfunc\nlet done = 'yes'"
|
||||
call assert_true(exists('*Xtest'))
|
||||
call assert_equal('yes', done)
|
||||
delfunc Xtest
|
||||
unlet done
|
||||
|
||||
exe "func Xtest()\necho 'hello'\nendfunc|let done = 'yes'"
|
||||
call assert_true(exists('*Xtest'))
|
||||
call assert_equal('yes', done)
|
||||
delfunc Xtest
|
||||
unlet done
|
||||
|
||||
" trailing line break
|
||||
exe "func Xtest()\necho 'hello'\nendfunc\n"
|
||||
call assert_true(exists('*Xtest'))
|
||||
delfunc Xtest
|
||||
|
||||
set verbose=1
|
||||
exe "func Xtest()\necho 'hello'\nendfunc \" garbage"
|
||||
call assert_true(exists('*Xtest'))
|
||||
delfunc Xtest
|
||||
|
||||
call assert_fails("func Xtest()\necho 'hello'\nendfunc garbage", 'E946')
|
||||
call assert_true(exists('*Xtest'))
|
||||
delfunc Xtest
|
||||
set verbose=0
|
||||
|
||||
function Foo()
|
||||
echo 'hello'
|
||||
endfunction | echo 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
delfunc Foo
|
||||
endfunc
|
||||
|
||||
func Test_delfunction_force()
|
||||
delfunc! Xtest
|
||||
delfunc! Xtest
|
||||
func Xtest()
|
||||
echo 'nothing'
|
||||
endfunc
|
||||
delfunc! Xtest
|
||||
delfunc! Xtest
|
||||
endfunc
|
||||
|
||||
" Test using bang after user command {{{1
|
||||
func Test_user_command_with_bang()
|
||||
command -bang Nieuw let nieuw = 1
|
||||
Ni!
|
||||
call assert_equal(1, nieuw)
|
||||
unlet nieuw
|
||||
delcommand Nieuw
|
||||
endfunc
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Modelines {{{1
|
||||
" vim: ts=8 sw=4 tw=80 fdm=marker
|
||||
|
@@ -1498,6 +1498,7 @@ static const int included_patches[] = {
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
Reference in New Issue
Block a user