mirror of
https://github.com/vim/vim.git
synced 2025-11-13 22:54:27 -05:00
patch 9.1.1913: Error message with :unlet! and non-existing dictionary item
Problem: Error message with :unlet! and non-existing dictionary item
(Coacher)
Solution: Set GLV_QUIET when using unlet with bang attribute
fixes: #18516
closes: #18734
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -2022,7 +2022,7 @@ ex_let_one(
|
|||||||
void
|
void
|
||||||
ex_unlet(exarg_T *eap)
|
ex_unlet(exarg_T *eap)
|
||||||
{
|
{
|
||||||
ex_unletlock(eap, eap->arg, 0, 0, do_unlet_var, NULL);
|
ex_unletlock(eap, eap->arg, 0, eap->forceit ? GLV_QUIET : 0, do_unlet_var, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -64,4 +64,16 @@ func Test_unlet_complete()
|
|||||||
call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
|
call assert_true(!exists('$FOOBAR') || empty($FOOBAR))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_unlet_nonexisting_key()
|
||||||
|
let g:base = {}
|
||||||
|
call assert_fails(':unlet g:base["foobar"]', 'E716:')
|
||||||
|
|
||||||
|
try
|
||||||
|
unlet! g:base["foobar"]
|
||||||
|
catch
|
||||||
|
call assert_report("error when unletting non-existing dict key")
|
||||||
|
endtry
|
||||||
|
unlet g:base
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -729,6 +729,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 */
|
||||||
|
/**/
|
||||||
|
1913,
|
||||||
/**/
|
/**/
|
||||||
1912,
|
1912,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user