mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.0.0068 (#6243)
Problem: Checking did_throw after executing autocommands is wrong. (Daniel
Hahler)
Solution: Call aborting() instead, and only when autocommands were executed.
21662be221
This commit is contained in:
parent
d1afd434f3
commit
eb8cbfc8f5
@ -994,11 +994,12 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*qfpos != '0') {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
|
||||
curbuf->b_fname, TRUE, curbuf);
|
||||
if (did_throw || force_abort)
|
||||
return FALSE;
|
||||
if (*qfpos != '0'
|
||||
&& apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3023,11 +3023,11 @@ void ex_make(exarg_T *eap)
|
||||
case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break;
|
||||
default: break;
|
||||
}
|
||||
if (au_name != NULL) {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, TRUE, curbuf);
|
||||
if (did_throw || force_abort)
|
||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_lgrep
|
||||
@ -3487,11 +3487,11 @@ void ex_vimgrep(exarg_T *eap)
|
||||
case CMD_lgrepadd: au_name = (char_u *)"lgrepadd"; break;
|
||||
default: break;
|
||||
}
|
||||
if (au_name != NULL) {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, TRUE, curbuf);
|
||||
if (did_throw || force_abort)
|
||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (eap->cmdidx == CMD_lgrep
|
||||
@ -4310,10 +4310,9 @@ void ex_cbuffer(exarg_T *eap)
|
||||
break;
|
||||
}
|
||||
|
||||
if (au_name != NULL) {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name,
|
||||
curbuf->b_fname, true, curbuf);
|
||||
if (did_throw || force_abort) {
|
||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name,
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4396,10 +4395,9 @@ void ex_cexpr(exarg_T *eap)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (au_name != NULL) {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name,
|
||||
curbuf->b_fname, true, curbuf);
|
||||
if (did_throw || force_abort) {
|
||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)au_name,
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4455,11 +4453,11 @@ void ex_helpgrep(exarg_T *eap)
|
||||
case CMD_lhelpgrep: au_name = (char_u *)"lhelpgrep"; break;
|
||||
default: break;
|
||||
}
|
||||
if (au_name != NULL) {
|
||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, TRUE, curbuf);
|
||||
if (did_throw || force_abort)
|
||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||
curbuf->b_fname, true, curbuf)) {
|
||||
if (aborting()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
||||
|
@ -1560,3 +1560,20 @@ function Test_Autocmd()
|
||||
\ 'postcaddbuffer']
|
||||
call assert_equal(l, g:acmds)
|
||||
endfunction
|
||||
|
||||
function! Test_Autocmd_Exception()
|
||||
set efm=%m
|
||||
lgetexpr '?'
|
||||
|
||||
try
|
||||
call DoesNotExit()
|
||||
catch
|
||||
lgetexpr '1'
|
||||
finally
|
||||
lgetexpr '1'
|
||||
endtry
|
||||
|
||||
call assert_equal('1', getloclist(0)[0].text)
|
||||
|
||||
set efm&vim
|
||||
endfunction
|
||||
|
Loading…
Reference in New Issue
Block a user