mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.1.1193: Unnecessary use of STRCAT() in au_event_disable()
Problem: Unnecessary use of STRCAT() in au_event_disable(). STRCAT() seeks to the end of new_ei, but here the end is already known. Solution: Use STRCPY() and add p_ei_len to new_ei. Also fix a typo in a comment. Add a test that 'eventignore' works in :argdo (zeertzjq). closes: #16844 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
parent
835bc014c0
commit
969e11a18b
@ -870,7 +870,7 @@ au_event_disable(char *what)
|
|||||||
if (*what == ',' && *p_ei == NUL)
|
if (*what == ',' && *p_ei == NUL)
|
||||||
STRCPY(new_ei, what + 1);
|
STRCPY(new_ei, what + 1);
|
||||||
else
|
else
|
||||||
STRCAT(new_ei, what);
|
STRCPY(new_ei + p_ei_len, what);
|
||||||
set_string_option_direct((char_u *)"ei", -1, new_ei,
|
set_string_option_direct((char_u *)"ei", -1, new_ei,
|
||||||
OPT_FREE, SID_NONE);
|
OPT_FREE, SID_NONE);
|
||||||
vim_free(new_ei);
|
vim_free(new_ei);
|
||||||
|
@ -4716,7 +4716,7 @@ open_cmdwin(void)
|
|||||||
State = MODE_NORMAL;
|
State = MODE_NORMAL;
|
||||||
setmouse();
|
setmouse();
|
||||||
|
|
||||||
// Reset here so it can be set by a CmdWinEnter autocommand.
|
// Reset here so it can be set by a CmdwinEnter autocommand.
|
||||||
cmdwin_result = 0;
|
cmdwin_result = 0;
|
||||||
|
|
||||||
// Trigger CmdwinEnter autocommands.
|
// Trigger CmdwinEnter autocommands.
|
||||||
|
@ -554,9 +554,34 @@ endfunc
|
|||||||
func Test_argdo()
|
func Test_argdo()
|
||||||
next! Xa.c Xb.c Xc.c
|
next! Xa.c Xb.c Xc.c
|
||||||
new
|
new
|
||||||
|
|
||||||
|
let g:bufenter = 0
|
||||||
|
let g:bufleave = 0
|
||||||
|
autocmd BufEnter * let g:bufenter += 1
|
||||||
|
autocmd BufLeave * let g:bufleave += 1
|
||||||
|
|
||||||
let l = []
|
let l = []
|
||||||
argdo call add(l, expand('%'))
|
argdo call add(l, expand('%'))
|
||||||
call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
|
call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
|
||||||
|
call assert_equal(3, g:bufenter)
|
||||||
|
call assert_equal(3, g:bufleave)
|
||||||
|
|
||||||
|
let g:bufenter = 0
|
||||||
|
let g:bufleave = 0
|
||||||
|
|
||||||
|
set eventignore=BufEnter,BufLeave
|
||||||
|
let l = []
|
||||||
|
argdo call add(l, expand('%'))
|
||||||
|
call assert_equal(['Xa.c', 'Xb.c', 'Xc.c'], l)
|
||||||
|
call assert_equal(0, g:bufenter)
|
||||||
|
call assert_equal(0, g:bufleave)
|
||||||
|
call assert_equal('BufEnter,BufLeave', &eventignore)
|
||||||
|
set eventignore&
|
||||||
|
|
||||||
|
autocmd! BufEnter
|
||||||
|
autocmd! BufLeave
|
||||||
|
unlet g:bufenter
|
||||||
|
unlet g:bufleave
|
||||||
bwipe Xa.c Xb.c Xc.c
|
bwipe Xa.c Xb.c Xc.c
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@ -704,6 +704,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 */
|
||||||
|
/**/
|
||||||
|
1193,
|
||||||
/**/
|
/**/
|
||||||
1192,
|
1192,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user