mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.1564: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and increases code size of tiny Vim by only 40 Kbyte.
This commit is contained in:
parent
3f54fd319f
commit
f2bd8ef2b4
224
src/buffer.c
224
src/buffer.c
@ -63,9 +63,7 @@ static void insert_sign(buf_T *buf, signlist_T *prev, signlist_T *next, int id,
|
|||||||
static char *msg_loclist = N_("[Location List]");
|
static char *msg_loclist = N_("[Location List]");
|
||||||
static char *msg_qflist = N_("[Quickfix List]");
|
static char *msg_qflist = N_("[Quickfix List]");
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static char *e_auabort = N_("E855: Autocommands caused command to abort");
|
static char *e_auabort = N_("E855: Autocommands caused command to abort");
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Number of times free_buffer() was called. */
|
/* Number of times free_buffer() was called. */
|
||||||
static int buf_free_count = 0;
|
static int buf_free_count = 0;
|
||||||
@ -116,17 +114,15 @@ read_buffer(
|
|||||||
else if (retval == OK)
|
else if (retval == OK)
|
||||||
unchanged(curbuf, FALSE);
|
unchanged(curbuf, FALSE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (retval == OK)
|
if (retval == OK)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
|
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
|
||||||
curbuf, &retval);
|
curbuf, &retval);
|
||||||
# else
|
#else
|
||||||
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -143,9 +139,7 @@ open_buffer(
|
|||||||
int flags) /* extra flags for readfile() */
|
int flags) /* extra flags for readfile() */
|
||||||
{
|
{
|
||||||
int retval = OK;
|
int retval = OK;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T old_curbuf;
|
bufref_T old_curbuf;
|
||||||
#endif
|
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
long old_tw = curbuf->b_p_tw;
|
long old_tw = curbuf->b_p_tw;
|
||||||
#endif
|
#endif
|
||||||
@ -188,12 +182,10 @@ open_buffer(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* The autocommands in readfile() may change the buffer, but only AFTER
|
/* The autocommands in readfile() may change the buffer, but only AFTER
|
||||||
* reading the file. */
|
* reading the file. */
|
||||||
set_bufref(&old_curbuf, curbuf);
|
set_bufref(&old_curbuf, curbuf);
|
||||||
modified_was_set = FALSE;
|
modified_was_set = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* mark cursor position as being invalid */
|
/* mark cursor position as being invalid */
|
||||||
curwin->w_valid = 0;
|
curwin->w_valid = 0;
|
||||||
@ -289,11 +281,9 @@ open_buffer(
|
|||||||
* the changed flag. Unless in readonly mode: "ls | gview -".
|
* the changed flag. Unless in readonly mode: "ls | gview -".
|
||||||
* When interrupted and 'cpoptions' contains 'i' set changed flag. */
|
* When interrupted and 'cpoptions' contains 'i' set changed flag. */
|
||||||
if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
|| modified_was_set /* ":set modified" used in autocmd */
|
|| modified_was_set /* ":set modified" used in autocmd */
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
|| (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
changed();
|
changed();
|
||||||
@ -315,25 +305,22 @@ open_buffer(
|
|||||||
foldUpdateAll(curwin);
|
foldUpdateAll(curwin);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* need to set w_topline, unless some autocommand already did that. */
|
/* need to set w_topline, unless some autocommand already did that. */
|
||||||
if (!(curwin->w_valid & VALID_TOPLINE))
|
if (!(curwin->w_valid & VALID_TOPLINE))
|
||||||
{
|
{
|
||||||
curwin->w_topline = 1;
|
curwin->w_topline = 1;
|
||||||
# ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval);
|
apply_autocmds_retval(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf, &retval);
|
||||||
# else
|
#else
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (retval == OK)
|
if (retval == OK)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* The autocommands may have changed the current buffer. Apply the
|
* The autocommands may have changed the current buffer. Apply the
|
||||||
* modelines to the correct buffer, if it still exists and is loaded.
|
* modelines to the correct buffer, if it still exists and is loaded.
|
||||||
@ -344,22 +331,19 @@ open_buffer(
|
|||||||
|
|
||||||
/* Go to the buffer that was opened. */
|
/* Go to the buffer that was opened. */
|
||||||
aucmd_prepbuf(&aco, old_curbuf.br_buf);
|
aucmd_prepbuf(&aco, old_curbuf.br_buf);
|
||||||
#endif
|
|
||||||
do_modelines(0);
|
do_modelines(0);
|
||||||
curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED);
|
curbuf->b_flags &= ~(BF_CHECK_RO | BF_NEVERLOADED);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#ifdef FEAT_EVAL
|
||||||
# ifdef FEAT_EVAL
|
|
||||||
apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf,
|
apply_autocmds_retval(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf,
|
||||||
&retval);
|
&retval);
|
||||||
# else
|
#else
|
||||||
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* restore curwin/curbuf and a few other things */
|
/* restore curwin/curbuf and a few other things */
|
||||||
aucmd_restbuf(&aco);
|
aucmd_restbuf(&aco);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
@ -454,14 +438,12 @@ close_buffer(
|
|||||||
int action,
|
int action,
|
||||||
int abort_if_last UNUSED)
|
int abort_if_last UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int is_curbuf;
|
int is_curbuf;
|
||||||
int nwindows;
|
int nwindows;
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
|
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
|
||||||
win_T *the_curwin = curwin;
|
win_T *the_curwin = curwin;
|
||||||
tabpage_T *the_curtab = curtab;
|
tabpage_T *the_curtab = curtab;
|
||||||
#endif
|
|
||||||
int unload_buf = (action != 0);
|
int unload_buf = (action != 0);
|
||||||
int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
|
int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
|
||||||
int wipe_buf = (action == DOBUF_WIPE);
|
int wipe_buf = (action == DOBUF_WIPE);
|
||||||
@ -510,7 +492,6 @@ close_buffer(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Disallow deleting the buffer when it is locked (already being closed or
|
/* Disallow deleting the buffer when it is locked (already being closed or
|
||||||
* halfway a command that relies on it). Unloading is allowed. */
|
* halfway a command that relies on it). Unloading is allowed. */
|
||||||
if (buf->b_locked > 0 && (del_buf || wipe_buf))
|
if (buf->b_locked > 0 && (del_buf || wipe_buf))
|
||||||
@ -518,7 +499,6 @@ close_buffer(
|
|||||||
EMSG(_("E937: Attempt to delete a buffer that is in use"));
|
EMSG(_("E937: Attempt to delete a buffer that is in use"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* check no autocommands closed the window */
|
/* check no autocommands closed the window */
|
||||||
if (win != NULL && win_valid_any_tab(win))
|
if (win != NULL && win_valid_any_tab(win))
|
||||||
@ -534,7 +514,6 @@ close_buffer(
|
|||||||
win->w_cursor.col, TRUE);
|
win->w_cursor.col, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
|
|
||||||
/* When the buffer is no longer in a window, trigger BufWinLeave */
|
/* When the buffer is no longer in a window, trigger BufWinLeave */
|
||||||
@ -570,10 +549,10 @@ aucmd_abort:
|
|||||||
/* Autocommands made this the only window. */
|
/* Autocommands made this the only window. */
|
||||||
goto aucmd_abort;
|
goto aucmd_abort;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return;
|
return;
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the buffer was in curwin and the window has changed, go back to that
|
/* If the buffer was in curwin and the window has changed, go back to that
|
||||||
@ -587,7 +566,6 @@ aucmd_abort:
|
|||||||
}
|
}
|
||||||
|
|
||||||
nwindows = buf->b_nwindows;
|
nwindows = buf->b_nwindows;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* decrease the link count from windows (unless not in any window) */
|
/* decrease the link count from windows (unless not in any window) */
|
||||||
if (buf->b_nwindows > 0)
|
if (buf->b_nwindows > 0)
|
||||||
@ -620,23 +598,20 @@ aucmd_abort:
|
|||||||
* Free all things allocated for this buffer.
|
* Free all things allocated for this buffer.
|
||||||
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Remember if we are closing the current buffer. Restore the number of
|
/* Remember if we are closing the current buffer. Restore the number of
|
||||||
* windows, so that autocommands in buf_freeall() don't get confused. */
|
* windows, so that autocommands in buf_freeall() don't get confused. */
|
||||||
is_curbuf = (buf == curbuf);
|
is_curbuf = (buf == curbuf);
|
||||||
buf->b_nwindows = nwindows;
|
buf->b_nwindows = nwindows;
|
||||||
#endif
|
|
||||||
|
|
||||||
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Autocommands may have deleted the buffer. */
|
/* Autocommands may have deleted the buffer. */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
return;
|
return;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return;
|
return;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's possible that autocommands change curbuf to the one being deleted.
|
* It's possible that autocommands change curbuf to the one being deleted.
|
||||||
@ -655,7 +630,6 @@ aucmd_abort:
|
|||||||
* Decrement the count for the close we do here. */
|
* Decrement the count for the close we do here. */
|
||||||
if (buf->b_nwindows > 0)
|
if (buf->b_nwindows > 0)
|
||||||
--buf->b_nwindows;
|
--buf->b_nwindows;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the buffer from the list.
|
* Remove the buffer from the list.
|
||||||
@ -732,7 +706,6 @@ buf_clear_file(buf_T *buf)
|
|||||||
void
|
void
|
||||||
buf_freeall(buf_T *buf, int flags)
|
buf_freeall(buf_T *buf, int flags)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int is_curbuf = (buf == curbuf);
|
int is_curbuf = (buf == curbuf);
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
|
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
|
||||||
@ -778,10 +751,10 @@ buf_freeall(buf_T *buf, int flags)
|
|||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return;
|
return;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It's possible that autocommands change curbuf to the one being deleted.
|
* It's possible that autocommands change curbuf to the one being deleted.
|
||||||
@ -791,7 +764,6 @@ buf_freeall(buf_T *buf, int flags)
|
|||||||
*/
|
*/
|
||||||
if (buf == curbuf && !is_curbuf)
|
if (buf == curbuf && !is_curbuf)
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
|
diff_buf_delete(buf); /* Can't use 'diff' for unloaded buffer. */
|
||||||
#endif
|
#endif
|
||||||
@ -870,7 +842,6 @@ free_buffer(buf_T *buf)
|
|||||||
|
|
||||||
buf_hashtab_remove(buf);
|
buf_hashtab_remove(buf);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
aubuflocal_remove(buf);
|
aubuflocal_remove(buf);
|
||||||
|
|
||||||
if (autocmd_busy)
|
if (autocmd_busy)
|
||||||
@ -881,7 +852,6 @@ free_buffer(buf_T *buf)
|
|||||||
au_pending_free_buf = buf;
|
au_pending_free_buf = buf;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
vim_free(buf);
|
vim_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -994,7 +964,7 @@ goto_buffer(
|
|||||||
# if defined(HAS_SWAP_EXISTS_ACTION)
|
# if defined(HAS_SWAP_EXISTS_ACTION)
|
||||||
if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
|
if (swap_exists_action == SEA_QUIT && *eap->cmd == 's')
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
cleanup_T cs;
|
cleanup_T cs;
|
||||||
|
|
||||||
/* Reset the error/interrupt/exception state here so that
|
/* Reset the error/interrupt/exception state here so that
|
||||||
@ -1007,7 +977,7 @@ goto_buffer(
|
|||||||
swap_exists_action = SEA_NONE;
|
swap_exists_action = SEA_NONE;
|
||||||
swap_exists_did_quit = TRUE;
|
swap_exists_did_quit = TRUE;
|
||||||
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not discarded by a
|
/* Restore the error/interrupt/exception state if not discarded by a
|
||||||
* new aborting error, interrupt, or uncaught exception. */
|
* new aborting error, interrupt, or uncaught exception. */
|
||||||
leave_cleanup(&cs);
|
leave_cleanup(&cs);
|
||||||
@ -1027,17 +997,17 @@ goto_buffer(
|
|||||||
void
|
void
|
||||||
handle_swap_exists(bufref_T *old_curbuf)
|
handle_swap_exists(bufref_T *old_curbuf)
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
cleanup_T cs;
|
cleanup_T cs;
|
||||||
# endif
|
# endif
|
||||||
#ifdef FEAT_SYN_HL
|
# ifdef FEAT_SYN_HL
|
||||||
long old_tw = curbuf->b_p_tw;
|
long old_tw = curbuf->b_p_tw;
|
||||||
#endif
|
# endif
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
if (swap_exists_action == SEA_QUIT)
|
if (swap_exists_action == SEA_QUIT)
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Reset the error/interrupt/exception state here so that
|
/* Reset the error/interrupt/exception state here so that
|
||||||
* aborting() returns FALSE when closing a buffer. */
|
* aborting() returns FALSE when closing a buffer. */
|
||||||
enter_cleanup(&cs);
|
enter_cleanup(&cs);
|
||||||
@ -1057,14 +1027,14 @@ handle_swap_exists(bufref_T *old_curbuf)
|
|||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
{
|
{
|
||||||
enter_buffer(buf);
|
enter_buffer(buf);
|
||||||
#ifdef FEAT_SYN_HL
|
# ifdef FEAT_SYN_HL
|
||||||
if (old_tw != curbuf->b_p_tw)
|
if (old_tw != curbuf->b_p_tw)
|
||||||
check_colorcolumn(curwin);
|
check_colorcolumn(curwin);
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
/* If "old_curbuf" is NULL we are in big trouble here... */
|
/* If "old_curbuf" is NULL we are in big trouble here... */
|
||||||
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not discarded by a
|
/* Restore the error/interrupt/exception state if not discarded by a
|
||||||
* new aborting error, interrupt, or uncaught exception. */
|
* new aborting error, interrupt, or uncaught exception. */
|
||||||
leave_cleanup(&cs);
|
leave_cleanup(&cs);
|
||||||
@ -1072,7 +1042,7 @@ handle_swap_exists(bufref_T *old_curbuf)
|
|||||||
}
|
}
|
||||||
else if (swap_exists_action == SEA_RECOVER)
|
else if (swap_exists_action == SEA_RECOVER)
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Reset the error/interrupt/exception state here so that
|
/* Reset the error/interrupt/exception state here so that
|
||||||
* aborting() returns FALSE when closing a buffer. */
|
* aborting() returns FALSE when closing a buffer. */
|
||||||
enter_cleanup(&cs);
|
enter_cleanup(&cs);
|
||||||
@ -1085,7 +1055,7 @@ handle_swap_exists(bufref_T *old_curbuf)
|
|||||||
cmdline_row = msg_row;
|
cmdline_row = msg_row;
|
||||||
do_modelines(0);
|
do_modelines(0);
|
||||||
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not discarded by a
|
/* Restore the error/interrupt/exception state if not discarded by a
|
||||||
* new aborting error, interrupt, or uncaught exception. */
|
* new aborting error, interrupt, or uncaught exception. */
|
||||||
leave_cleanup(&cs);
|
leave_cleanup(&cs);
|
||||||
@ -1400,23 +1370,21 @@ do_buffer(
|
|||||||
|
|
||||||
if (!forceit && bufIsChanged(buf))
|
if (!forceit && bufIsChanged(buf))
|
||||||
{
|
{
|
||||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
# if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
||||||
if ((p_confirm || cmdmod.confirm) && p_write)
|
if ((p_confirm || cmdmod.confirm) && p_write)
|
||||||
{
|
{
|
||||||
dialog_changed(buf, FALSE);
|
dialog_changed(buf, FALSE);
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
/* Autocommand deleted buffer, oops! It's not changed
|
/* Autocommand deleted buffer, oops! It's not changed
|
||||||
* now. */
|
* now. */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
|
||||||
/* If it's still changed fail silently, the dialog already
|
/* If it's still changed fail silently, the dialog already
|
||||||
* mentioned why it fails. */
|
* mentioned why it fails. */
|
||||||
if (bufIsChanged(buf))
|
if (bufIsChanged(buf))
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
{
|
{
|
||||||
EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"),
|
EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"),
|
||||||
buf->b_fnum);
|
buf->b_fnum);
|
||||||
@ -1444,9 +1412,7 @@ do_buffer(
|
|||||||
* a window with this buffer.
|
* a window with this buffer.
|
||||||
*/
|
*/
|
||||||
while (buf == curbuf
|
while (buf == curbuf
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
|
&& !(curwin->w_closing || curwin->w_buffer->b_locked > 0)
|
||||||
#endif
|
|
||||||
&& (!ONE_WINDOW || first_tabpage->tp_next != NULL))
|
&& (!ONE_WINDOW || first_tabpage->tp_next != NULL))
|
||||||
{
|
{
|
||||||
if (win_close(curwin, FALSE) == FAIL)
|
if (win_close(curwin, FALSE) == FAIL)
|
||||||
@ -1476,15 +1442,10 @@ do_buffer(
|
|||||||
*/
|
*/
|
||||||
buf = NULL; /* selected buffer */
|
buf = NULL; /* selected buffer */
|
||||||
bp = NULL; /* used when no loaded buffer found */
|
bp = NULL; /* used when no loaded buffer found */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf))
|
if (au_new_curbuf.br_buf != NULL && bufref_valid(&au_new_curbuf))
|
||||||
buf = au_new_curbuf.br_buf;
|
buf = au_new_curbuf.br_buf;
|
||||||
# ifdef FEAT_JUMPLIST
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_JUMPLIST
|
#ifdef FEAT_JUMPLIST
|
||||||
if (curwin->w_jumplistlen > 0)
|
else if (curwin->w_jumplistlen > 0)
|
||||||
{
|
{
|
||||||
int jumpidx;
|
int jumpidx;
|
||||||
|
|
||||||
@ -1603,17 +1564,13 @@ do_buffer(
|
|||||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
||||||
if ((p_confirm || cmdmod.confirm) && p_write)
|
if ((p_confirm || cmdmod.confirm) && p_write)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
# endif
|
|
||||||
dialog_changed(curbuf, FALSE);
|
dialog_changed(curbuf, FALSE);
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
/* Autocommand deleted buffer, oops! */
|
/* Autocommand deleted buffer, oops! */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
if (bufIsChanged(curbuf))
|
if (bufIsChanged(curbuf))
|
||||||
#endif
|
#endif
|
||||||
@ -1634,7 +1591,7 @@ do_buffer(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#endif
|
#endif
|
||||||
@ -1678,17 +1635,15 @@ set_curbuf(buf_T *buf, int action)
|
|||||||
set_bufref(&prevbufref, prevbuf);
|
set_bufref(&prevbufref, prevbuf);
|
||||||
set_bufref(&newbufref, buf);
|
set_bufref(&newbufref, buf);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Autocommands may delete the curren buffer and/or the buffer we wan to go
|
/* Autocommands may delete the curren buffer and/or the buffer we wan to go
|
||||||
* to. In those cases don't close the buffer. */
|
* to. In those cases don't close the buffer. */
|
||||||
if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf)
|
if (!apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf)
|
||||||
|| (bufref_valid(&prevbufref)
|
|| (bufref_valid(&prevbufref)
|
||||||
&& bufref_valid(&newbufref)
|
&& bufref_valid(&newbufref)
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
&& !aborting()
|
&& !aborting()
|
||||||
# endif
|
|
||||||
))
|
|
||||||
#endif
|
#endif
|
||||||
|
))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
if (prevbuf == curwin->w_buffer)
|
if (prevbuf == curwin->w_buffer)
|
||||||
@ -1696,7 +1651,7 @@ set_curbuf(buf_T *buf, int action)
|
|||||||
#endif
|
#endif
|
||||||
if (unload)
|
if (unload)
|
||||||
close_windows(prevbuf, FALSE);
|
close_windows(prevbuf, FALSE);
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (bufref_valid(&prevbufref) && !aborting())
|
if (bufref_valid(&prevbufref) && !aborting())
|
||||||
#else
|
#else
|
||||||
if (bufref_valid(&prevbufref))
|
if (bufref_valid(&prevbufref))
|
||||||
@ -1714,16 +1669,14 @@ set_curbuf(buf_T *buf, int action)
|
|||||||
curwin = previouswin;
|
curwin = previouswin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
/* An autocommand may have deleted "buf", already entered it (e.g., when
|
||||||
* it did ":bunload") or aborted the script processing.
|
* it did ":bunload") or aborted the script processing.
|
||||||
* If curwin->w_buffer is null, enter_buffer() will make it valid again */
|
* If curwin->w_buffer is null, enter_buffer() will make it valid again */
|
||||||
if ((buf_valid(buf) && buf != curbuf
|
if ((buf_valid(buf) && buf != curbuf
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
&& !aborting()
|
&& !aborting()
|
||||||
# endif
|
|
||||||
) || curwin->w_buffer == NULL)
|
|
||||||
#endif
|
#endif
|
||||||
|
) || curwin->w_buffer == NULL)
|
||||||
{
|
{
|
||||||
enter_buffer(buf);
|
enter_buffer(buf);
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
@ -1773,9 +1726,7 @@ enter_buffer(buf_T *buf)
|
|||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
#endif
|
#endif
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
curwin->w_topline_was_set = FALSE;
|
curwin->w_topline_was_set = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* mark cursor position as being invalid */
|
/* mark cursor position as being invalid */
|
||||||
curwin->w_valid = 0;
|
curwin->w_valid = 0;
|
||||||
@ -1783,13 +1734,11 @@ enter_buffer(buf_T *buf)
|
|||||||
/* Make sure the buffer is loaded. */
|
/* Make sure the buffer is loaded. */
|
||||||
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
|
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If there is no filetype, allow for detecting one. Esp. useful for
|
/* If there is no filetype, allow for detecting one. Esp. useful for
|
||||||
* ":ball" used in a autocommand. If there already is a filetype we
|
* ":ball" used in a autocommand. If there already is a filetype we
|
||||||
* might prefer to keep it. */
|
* might prefer to keep it. */
|
||||||
if (*curbuf->b_p_ft == NUL)
|
if (*curbuf->b_p_ft == NUL)
|
||||||
did_filetype = FALSE;
|
did_filetype = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
open_buffer(FALSE, NULL, 0);
|
open_buffer(FALSE, NULL, 0);
|
||||||
}
|
}
|
||||||
@ -1798,14 +1747,12 @@ enter_buffer(buf_T *buf)
|
|||||||
if (!msg_silent)
|
if (!msg_silent)
|
||||||
need_fileinfo = TRUE; /* display file info after redraw */
|
need_fileinfo = TRUE; /* display file info after redraw */
|
||||||
(void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */
|
(void)buf_check_timestamp(curbuf, FALSE); /* check if file changed */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
curwin->w_topline = 1;
|
curwin->w_topline = 1;
|
||||||
# ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
curwin->w_topfill = 0;
|
curwin->w_topfill = 0;
|
||||||
# endif
|
#endif
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If autocommands did not change the cursor position, restore cursor lnum
|
/* If autocommands did not change the cursor position, restore cursor lnum
|
||||||
@ -1817,10 +1764,8 @@ enter_buffer(buf_T *buf)
|
|||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
maketitle();
|
maketitle();
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* when autocmds didn't change it */
|
/* when autocmds didn't change it */
|
||||||
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
|
if (curwin->w_topline == 1 && !curwin->w_topline_was_set)
|
||||||
#endif
|
|
||||||
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
scroll_cursor_halfway(FALSE); /* redisplay at correct position */
|
||||||
|
|
||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
@ -1948,11 +1893,9 @@ buflist_new(
|
|||||||
|
|
||||||
if ((flags & BLN_LISTED) && !buf->b_p_bl)
|
if ((flags & BLN_LISTED) && !buf->b_p_bl)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
#endif
|
|
||||||
buf->b_p_bl = TRUE;
|
buf->b_p_bl = TRUE;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
if (!(flags & BLN_DUMMY))
|
if (!(flags & BLN_DUMMY))
|
||||||
{
|
{
|
||||||
@ -1960,7 +1903,6 @@ buflist_new(
|
|||||||
&& !bufref_valid(&bufref))
|
&& !bufref_valid(&bufref))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -1981,21 +1923,17 @@ buflist_new(
|
|||||||
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()))
|
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY()))
|
||||||
{
|
{
|
||||||
buf = curbuf;
|
buf = curbuf;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* It's like this buffer is deleted. Watch out for autocommands that
|
/* It's like this buffer is deleted. Watch out for autocommands that
|
||||||
* change curbuf! If that happens, allocate a new buffer anyway. */
|
* change curbuf! If that happens, allocate a new buffer anyway. */
|
||||||
if (curbuf->b_p_bl)
|
if (curbuf->b_p_bl)
|
||||||
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
||||||
if (buf == curbuf)
|
if (buf == curbuf)
|
||||||
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return NULL;
|
return NULL;
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (buf == curbuf)
|
if (buf == curbuf)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* Make sure 'bufhidden' and 'buftype' are empty */
|
/* Make sure 'bufhidden' and 'buftype' are empty */
|
||||||
clear_string_option(&buf->b_p_bh);
|
clear_string_option(&buf->b_p_bh);
|
||||||
@ -2049,7 +1987,7 @@ buflist_new(
|
|||||||
buf_freeall(buf, 0);
|
buf_freeall(buf, 0);
|
||||||
if (buf != curbuf) /* autocommands deleted the buffer! */
|
if (buf != curbuf) /* autocommands deleted the buffer! */
|
||||||
return NULL;
|
return NULL;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -2128,7 +2066,6 @@ buflist_new(
|
|||||||
clrallmarks(buf); /* clear marks */
|
clrallmarks(buf); /* clear marks */
|
||||||
fmarks_check_names(buf); /* check file marks for this file */
|
fmarks_check_names(buf); /* check file marks for this file */
|
||||||
buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */
|
buf->b_p_bl = (flags & BLN_LISTED) ? TRUE : FALSE; /* init 'buflisted' */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!(flags & BLN_DUMMY))
|
if (!(flags & BLN_DUMMY))
|
||||||
{
|
{
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
@ -2146,12 +2083,11 @@ buflist_new(
|
|||||||
&& !bufref_valid(&bufref))
|
&& !bufref_valid(&bufref))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return NULL;
|
return NULL;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -2230,9 +2166,7 @@ free_buf_options(
|
|||||||
#ifdef FEAT_SEARCHPATH
|
#ifdef FEAT_SEARCHPATH
|
||||||
clear_string_option(&buf->b_p_sua);
|
clear_string_option(&buf->b_p_sua);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
clear_string_option(&buf->b_p_ft);
|
clear_string_option(&buf->b_p_ft);
|
||||||
#endif
|
|
||||||
#ifdef FEAT_CINDENT
|
#ifdef FEAT_CINDENT
|
||||||
clear_string_option(&buf->b_p_cink);
|
clear_string_option(&buf->b_p_cink);
|
||||||
clear_string_option(&buf->b_p_cino);
|
clear_string_option(&buf->b_p_cino);
|
||||||
@ -2315,10 +2249,8 @@ buflist_getfile(
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* altfpos may be changed by getfile(), get it now */
|
/* altfpos may be changed by getfile(), get it now */
|
||||||
if (lnum == 0)
|
if (lnum == 0)
|
||||||
@ -4368,7 +4300,6 @@ build_stl_str_hl(
|
|||||||
: _("[Help]"));
|
: _("[Help]"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case STL_FILETYPE:
|
case STL_FILETYPE:
|
||||||
if (*wp->w_buffer->b_p_ft != NUL
|
if (*wp->w_buffer->b_p_ft != NUL
|
||||||
&& STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3)
|
&& STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3)
|
||||||
@ -4391,7 +4322,6 @@ build_stl_str_hl(
|
|||||||
str = tmp;
|
str = tmp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_QUICKFIX)
|
#if defined(FEAT_QUICKFIX)
|
||||||
case STL_PREVIEWFLAG:
|
case STL_PREVIEWFLAG:
|
||||||
@ -5013,20 +4943,18 @@ do_arg_all(
|
|||||||
if (!buf_hide(buf) && buf->b_nwindows <= 1
|
if (!buf_hide(buf) && buf->b_nwindows <= 1
|
||||||
&& bufIsChanged(buf))
|
&& bufIsChanged(buf))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
(void)autowrite(buf, FALSE);
|
(void)autowrite(buf, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* check if autocommands removed the window */
|
/* check if autocommands removed the window */
|
||||||
if (!win_valid(wp) || !bufref_valid(&bufref))
|
if (!win_valid(wp) || !bufref_valid(&bufref))
|
||||||
{
|
{
|
||||||
wpnext = firstwin; /* start all over... */
|
wpnext = firstwin; /* start all over... */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/* don't close last window */
|
/* don't close last window */
|
||||||
if (ONE_WINDOW
|
if (ONE_WINDOW
|
||||||
@ -5035,11 +4963,10 @@ do_arg_all(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
win_close(wp, !buf_hide(buf) && !bufIsChanged(buf));
|
win_close(wp, !buf_hide(buf) && !bufIsChanged(buf));
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* check if autocommands removed the next window */
|
/* check if autocommands removed the next window */
|
||||||
if (!win_valid(wpnext))
|
if (!win_valid(wpnext))
|
||||||
wpnext = firstwin; /* start all over... */
|
wpnext = firstwin; /* start all over... */
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5049,11 +4976,10 @@ do_arg_all(
|
|||||||
if (had_tab == 0 || tpnext == NULL)
|
if (had_tab == 0 || tpnext == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* check if autocommands removed the next tab page */
|
/* check if autocommands removed the next tab page */
|
||||||
if (!valid_tabpage(tpnext))
|
if (!valid_tabpage(tpnext))
|
||||||
tpnext = first_tabpage; /* start all over...*/
|
tpnext = first_tabpage; /* start all over...*/
|
||||||
# endif
|
|
||||||
goto_tabpage_tp(tpnext, TRUE, TRUE);
|
goto_tabpage_tp(tpnext, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5064,11 +4990,9 @@ do_arg_all(
|
|||||||
if (count > opened_len || count <= 0)
|
if (count > opened_len || count <= 0)
|
||||||
count = opened_len;
|
count = opened_len;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute Win/Buf Enter/Leave autocommands here. */
|
/* Don't execute Win/Buf Enter/Leave autocommands here. */
|
||||||
++autocmd_no_enter;
|
++autocmd_no_enter;
|
||||||
++autocmd_no_leave;
|
++autocmd_no_leave;
|
||||||
#endif
|
|
||||||
last_curwin = curwin;
|
last_curwin = curwin;
|
||||||
last_curtab = curtab;
|
last_curtab = curtab;
|
||||||
win_enter(lastwin, FALSE);
|
win_enter(lastwin, FALSE);
|
||||||
@ -5114,10 +5038,8 @@ do_arg_all(
|
|||||||
if (split_ret == FAIL)
|
if (split_ret == FAIL)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else /* first window: do autocmd for leaving this buffer */
|
else /* first window: do autocmd for leaving this buffer */
|
||||||
--autocmd_no_leave;
|
--autocmd_no_leave;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* edit file "i"
|
* edit file "i"
|
||||||
@ -5133,10 +5055,8 @@ do_arg_all(
|
|||||||
((buf_hide(curwin->w_buffer)
|
((buf_hide(curwin->w_buffer)
|
||||||
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
|
|| bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
|
||||||
+ ECMD_OLDBUF, curwin);
|
+ ECMD_OLDBUF, curwin);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (use_firstwin)
|
if (use_firstwin)
|
||||||
++autocmd_no_leave;
|
++autocmd_no_leave;
|
||||||
#endif
|
|
||||||
use_firstwin = FALSE;
|
use_firstwin = FALSE;
|
||||||
}
|
}
|
||||||
ui_breakcheck();
|
ui_breakcheck();
|
||||||
@ -5149,9 +5069,8 @@ do_arg_all(
|
|||||||
/* Remove the "lock" on the argument list. */
|
/* Remove the "lock" on the argument list. */
|
||||||
alist_unlink(alist);
|
alist_unlink(alist);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_enter;
|
--autocmd_no_enter;
|
||||||
#endif
|
|
||||||
/* restore last referenced tabpage's curwin */
|
/* restore last referenced tabpage's curwin */
|
||||||
if (last_curtab != new_curtab)
|
if (last_curtab != new_curtab)
|
||||||
{
|
{
|
||||||
@ -5166,9 +5085,7 @@ do_arg_all(
|
|||||||
if (win_valid(new_curwin))
|
if (win_valid(new_curwin))
|
||||||
win_enter(new_curwin, FALSE);
|
win_enter(new_curwin, FALSE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_leave;
|
--autocmd_no_leave;
|
||||||
#endif
|
|
||||||
vim_free(opened);
|
vim_free(opened);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5223,18 +5140,13 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
- tabline_height()
|
- tabline_height()
|
||||||
: wp->w_width != Columns)
|
: wp->w_width != Columns)
|
||||||
|| (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW
|
|| (had_tab > 0 && wp != firstwin)) && !ONE_WINDOW
|
||||||
#ifdef FEAT_AUTOCMD
|
&& !(wp->w_closing || wp->w_buffer->b_locked > 0))
|
||||||
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
win_close(wp, FALSE);
|
win_close(wp, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
wpnext = firstwin; /* just in case an autocommand does
|
wpnext = firstwin; /* just in case an autocommand does
|
||||||
something strange with windows */
|
something strange with windows */
|
||||||
tpnext = first_tabpage; /* start all over...*/
|
tpnext = first_tabpage; /* start all over...*/
|
||||||
open_wins = 0;
|
open_wins = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++open_wins;
|
++open_wins;
|
||||||
@ -5251,14 +5163,10 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
* open one. Otherwise move the window to the right position.
|
* open one. Otherwise move the window to the right position.
|
||||||
* Watch out for autocommands that delete buffers or windows!
|
* Watch out for autocommands that delete buffers or windows!
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute Win/Buf Enter/Leave autocommands here. */
|
/* Don't execute Win/Buf Enter/Leave autocommands here. */
|
||||||
++autocmd_no_enter;
|
++autocmd_no_enter;
|
||||||
#endif
|
|
||||||
win_enter(lastwin, FALSE);
|
win_enter(lastwin, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
++autocmd_no_leave;
|
++autocmd_no_leave;
|
||||||
#endif
|
|
||||||
for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next)
|
for (buf = firstbuf; buf != NULL && open_wins < count; buf = buf->b_next)
|
||||||
{
|
{
|
||||||
/* Check if this buffer needs a window */
|
/* Check if this buffer needs a window */
|
||||||
@ -5286,11 +5194,10 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
|
|
||||||
if (wp == NULL && split_ret == OK)
|
if (wp == NULL && split_ret == OK)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
/* Split the window and put the buffer in it */
|
/* Split the window and put the buffer in it */
|
||||||
p_ea_save = p_ea;
|
p_ea_save = p_ea;
|
||||||
p_ea = TRUE; /* use space from all windows */
|
p_ea = TRUE; /* use space from all windows */
|
||||||
@ -5305,20 +5212,18 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
swap_exists_action = SEA_DIALOG;
|
swap_exists_action = SEA_DIALOG;
|
||||||
#endif
|
#endif
|
||||||
set_curbuf(buf, DOBUF_GOTO);
|
set_curbuf(buf, DOBUF_GOTO);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
{
|
{
|
||||||
/* autocommands deleted the buffer!!! */
|
/* autocommands deleted the buffer!!! */
|
||||||
#if defined(HAS_SWAP_EXISTS_ACTION)
|
#if defined(HAS_SWAP_EXISTS_ACTION)
|
||||||
swap_exists_action = SEA_NONE;
|
swap_exists_action = SEA_NONE;
|
||||||
# endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(HAS_SWAP_EXISTS_ACTION)
|
#if defined(HAS_SWAP_EXISTS_ACTION)
|
||||||
if (swap_exists_action == SEA_QUIT)
|
if (swap_exists_action == SEA_QUIT)
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
cleanup_T cs;
|
cleanup_T cs;
|
||||||
|
|
||||||
/* Reset the error/interrupt/exception state here so that
|
/* Reset the error/interrupt/exception state here so that
|
||||||
@ -5332,7 +5237,7 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
swap_exists_action = SEA_NONE;
|
swap_exists_action = SEA_NONE;
|
||||||
swap_exists_did_quit = TRUE;
|
swap_exists_did_quit = TRUE;
|
||||||
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not
|
/* Restore the error/interrupt/exception state if not
|
||||||
* discarded by a new aborting error, interrupt, or uncaught
|
* discarded by a new aborting error, interrupt, or uncaught
|
||||||
* exception. */
|
* exception. */
|
||||||
@ -5359,13 +5264,9 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
|
if (had_tab > 0 && tabpage_index(NULL) <= p_tpm)
|
||||||
cmdmod.tab = 9999;
|
cmdmod.tab = 9999;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_enter;
|
--autocmd_no_enter;
|
||||||
#endif
|
|
||||||
win_enter(firstwin, FALSE); /* back to first window */
|
win_enter(firstwin, FALSE); /* back to first window */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_leave;
|
--autocmd_no_leave;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close superfluous windows.
|
* Close superfluous windows.
|
||||||
@ -5374,15 +5275,12 @@ ex_buffer_all(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer)
|
r = (buf_hide(wp->w_buffer) || !bufIsChanged(wp->w_buffer)
|
||||||
|| autowrite(wp->w_buffer, FALSE) == OK);
|
|| autowrite(wp->w_buffer, FALSE) == OK);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!win_valid(wp))
|
if (!win_valid(wp))
|
||||||
{
|
{
|
||||||
/* BufWrite Autocommands made the window invalid, start over */
|
/* BufWrite Autocommands made the window invalid, start over */
|
||||||
wp = lastwin;
|
wp = lastwin;
|
||||||
}
|
}
|
||||||
else
|
else if (r)
|
||||||
#endif
|
|
||||||
if (r)
|
|
||||||
{
|
{
|
||||||
win_close(wp, !buf_hide(wp->w_buffer));
|
win_close(wp, !buf_hide(wp->w_buffer));
|
||||||
--open_wins;
|
--open_wins;
|
||||||
@ -6233,12 +6131,10 @@ set_buflisted(int on)
|
|||||||
if (on != curbuf->b_p_bl)
|
if (on != curbuf->b_p_bl)
|
||||||
{
|
{
|
||||||
curbuf->b_p_bl = on;
|
curbuf->b_p_bl = on;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (on)
|
if (on)
|
||||||
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf);
|
||||||
else
|
else
|
||||||
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6311,13 +6207,11 @@ wipe_buffer(
|
|||||||
if (buf->b_fnum == top_file_num - 1)
|
if (buf->b_fnum == top_file_num - 1)
|
||||||
--top_file_num;
|
--top_file_num;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!aucmd) /* Don't trigger BufDelete autocommands here. */
|
if (!aucmd) /* Don't trigger BufDelete autocommands here. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
|
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!aucmd)
|
if (!aucmd)
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
10
src/diff.c
10
src/diff.c
@ -872,13 +872,9 @@ diff_file(
|
|||||||
(diff_flags & DIFF_ICASE) ? "-i " : "",
|
(diff_flags & DIFF_ICASE) ? "-i " : "",
|
||||||
tmp_orig, tmp_new);
|
tmp_orig, tmp_new);
|
||||||
append_redir(cmd, (int)len, p_srr, tmp_diff);
|
append_redir(cmd, (int)len, p_srr, tmp_diff);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
block_autocmds(); /* Avoid ShellCmdPost stuff */
|
block_autocmds(); /* Avoid ShellCmdPost stuff */
|
||||||
#endif
|
|
||||||
(void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
|
(void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
vim_free(cmd);
|
vim_free(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -984,13 +980,9 @@ ex_diffpatch(exarg_T *eap)
|
|||||||
* cooked mode to allow the user to respond to prompts. */
|
* cooked mode to allow the user to respond to prompts. */
|
||||||
vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s",
|
vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s",
|
||||||
tmp_new, tmp_orig, esc_name);
|
tmp_new, tmp_orig, esc_name);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
block_autocmds(); /* Avoid ShellCmdPost stuff */
|
block_autocmds(); /* Avoid ShellCmdPost stuff */
|
||||||
#endif
|
|
||||||
(void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
|
(void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
@ -1052,11 +1044,9 @@ ex_diffpatch(exarg_T *eap)
|
|||||||
eap->arg = newname;
|
eap->arg = newname;
|
||||||
ex_file(eap);
|
ex_file(eap);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Do filetype detection with the new name. */
|
/* Do filetype detection with the new name. */
|
||||||
if (au_has_group((char_u *)"filetypedetect"))
|
if (au_has_group((char_u *)"filetypedetect"))
|
||||||
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
|
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
91
src/edit.c
91
src/edit.c
@ -273,7 +273,7 @@ static int ins_ctrl_ey(int tc);
|
|||||||
static void ins_try_si(int c);
|
static void ins_try_si(int c);
|
||||||
#endif
|
#endif
|
||||||
static colnr_T get_nolist_virtcol(void);
|
static colnr_T get_nolist_virtcol(void);
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
static char_u *do_insert_char_pre(int c);
|
static char_u *do_insert_char_pre(int c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -388,7 +388,6 @@ edit(
|
|||||||
ins_compl_clear(); /* clear stuff for CTRL-X mode */
|
ins_compl_clear(); /* clear stuff for CTRL-X mode */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx".
|
* Trigger InsertEnter autocommands. Do not do this for "r<CR>" or "grx".
|
||||||
*/
|
*/
|
||||||
@ -396,7 +395,7 @@ edit(
|
|||||||
{
|
{
|
||||||
pos_T save_cursor = curwin->w_cursor;
|
pos_T save_cursor = curwin->w_cursor;
|
||||||
|
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (cmdchar == 'R')
|
if (cmdchar == 'R')
|
||||||
ptr = (char_u *)"r";
|
ptr = (char_u *)"r";
|
||||||
else if (cmdchar == 'V')
|
else if (cmdchar == 'V')
|
||||||
@ -405,7 +404,7 @@ edit(
|
|||||||
ptr = (char_u *)"i";
|
ptr = (char_u *)"i";
|
||||||
set_vim_var_string(VV_INSERTMODE, ptr, 1);
|
set_vim_var_string(VV_INSERTMODE, ptr, 1);
|
||||||
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
|
set_vim_var_string(VV_CHAR, NULL, -1); /* clear v:char */
|
||||||
# endif
|
#endif
|
||||||
apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf);
|
||||||
|
|
||||||
/* Make sure the cursor didn't move. Do call check_cursor_col() in
|
/* Make sure the cursor didn't move. Do call check_cursor_col() in
|
||||||
@ -415,9 +414,9 @@ edit(
|
|||||||
* line number is still valid (lines may have been deleted).
|
* line number is still valid (lines may have been deleted).
|
||||||
* Do not restore if v:char was set to a non-empty string. */
|
* Do not restore if v:char was set to a non-empty string. */
|
||||||
if (!EQUAL_POS(curwin->w_cursor, save_cursor)
|
if (!EQUAL_POS(curwin->w_cursor, save_cursor)
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
&& *get_vim_var_str(VV_CHAR) == NUL
|
&& *get_vim_var_str(VV_CHAR) == NUL
|
||||||
# endif
|
#endif
|
||||||
&& save_cursor.lnum <= curbuf->b_ml.ml_line_count)
|
&& save_cursor.lnum <= curbuf->b_ml.ml_line_count)
|
||||||
{
|
{
|
||||||
int save_state = State;
|
int save_state = State;
|
||||||
@ -428,7 +427,6 @@ edit(
|
|||||||
State = save_state;
|
State = save_state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
/* Check if the cursor line needs redrawing before changing State. If
|
/* Check if the cursor line needs redrawing before changing State. If
|
||||||
@ -521,7 +519,7 @@ edit(
|
|||||||
*/
|
*/
|
||||||
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
|
if (curbuf->b_p_iminsert == B_IMODE_LMAP)
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
|
im_set_active(curbuf->b_p_iminsert == B_IMODE_IM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -805,10 +803,8 @@ edit(
|
|||||||
c = safe_vgetc();
|
c = safe_vgetc();
|
||||||
} while (c == K_IGNORE || c == K_NOP);
|
} while (c == K_IGNORE || c == K_NOP);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
|
/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (p_hkmap && KeyTyped)
|
if (p_hkmap && KeyTyped)
|
||||||
@ -856,7 +852,7 @@ edit(
|
|||||||
* completion: Add to "compl_leader". */
|
* completion: Add to "compl_leader". */
|
||||||
if (ins_compl_accept_char(c))
|
if (ins_compl_accept_char(c))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
/* Trigger InsertCharPre. */
|
/* Trigger InsertCharPre. */
|
||||||
char_u *str = do_insert_char_pre(c);
|
char_u *str = do_insert_char_pre(c);
|
||||||
char_u *p;
|
char_u *p;
|
||||||
@ -1030,12 +1026,10 @@ doESCkey:
|
|||||||
|
|
||||||
if (ins_esc(&count, cmdchar, nomove))
|
if (ins_esc(&count, cmdchar, nomove))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (cmdchar != 'r' && cmdchar != 'v')
|
if (cmdchar != 'r' && cmdchar != 'v')
|
||||||
apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL,
|
apply_autocmds(EVENT_INSERTLEAVE, NULL, NULL,
|
||||||
FALSE, curbuf);
|
FALSE, curbuf);
|
||||||
did_cursorhold = FALSE;
|
did_cursorhold = FALSE;
|
||||||
#endif
|
|
||||||
return (c == Ctrl_O);
|
return (c == Ctrl_O);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -1234,12 +1228,10 @@ doESCkey:
|
|||||||
case K_IGNORE: /* Something mapped to nothing */
|
case K_IGNORE: /* Something mapped to nothing */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case K_CURSORHOLD: /* Didn't type something for a while. */
|
case K_CURSORHOLD: /* Didn't type something for a while. */
|
||||||
apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_CURSORHOLDI, NULL, NULL, FALSE, curbuf);
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_GUI_W32
|
#ifdef FEAT_GUI_W32
|
||||||
/* On Win32 ignore <M-F4>, we get it when closing the window was
|
/* On Win32 ignore <M-F4>, we get it when closing the window was
|
||||||
@ -1488,7 +1480,7 @@ normalchar:
|
|||||||
/*
|
/*
|
||||||
* Insert a normal character.
|
* Insert a normal character.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
if (!p_paste)
|
if (!p_paste)
|
||||||
{
|
{
|
||||||
/* Trigger InsertCharPre. */
|
/* Trigger InsertCharPre. */
|
||||||
@ -1565,16 +1557,14 @@ normalchar:
|
|||||||
break;
|
break;
|
||||||
} /* end of switch (c) */
|
} /* end of switch (c) */
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If typed something may trigger CursorHoldI again. */
|
/* If typed something may trigger CursorHoldI again. */
|
||||||
if (c != K_CURSORHOLD
|
if (c != K_CURSORHOLD
|
||||||
# ifdef FEAT_COMPL_FUNC
|
#ifdef FEAT_COMPL_FUNC
|
||||||
/* but not in CTRL-X mode, a script can't restore the state */
|
/* but not in CTRL-X mode, a script can't restore the state */
|
||||||
&& ctrl_x_mode == CTRL_X_NORMAL
|
&& ctrl_x_mode == CTRL_X_NORMAL
|
||||||
# endif
|
#endif
|
||||||
)
|
)
|
||||||
did_cursorhold = FALSE;
|
did_cursorhold = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If the cursor was moved we didn't just insert a space */
|
/* If the cursor was moved we didn't just insert a space */
|
||||||
if (arrow_used)
|
if (arrow_used)
|
||||||
@ -1624,25 +1614,17 @@ ins_redraw(
|
|||||||
if (char_avail())
|
if (char_avail())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
#if defined(FEAT_CONCEAL)
|
||||||
/* Trigger CursorMoved if the cursor moved. Not when the popup menu is
|
/* Trigger CursorMoved if the cursor moved. Not when the popup menu is
|
||||||
* visible, the command might delete it. */
|
* visible, the command might delete it. */
|
||||||
if (ready && (
|
if (ready && (has_cursormovedI()
|
||||||
# ifdef FEAT_AUTOCMD
|
# if defined(FEAT_CONCEAL)
|
||||||
has_cursormovedI()
|
|| curwin->w_p_cole > 0
|
||||||
# endif
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
|
|
||||||
||
|
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
|
||||||
curwin->w_p_cole > 0
|
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
# ifdef FEAT_AUTOCMD
|
&& !EQUAL_POS(last_cursormoved, curwin->w_cursor)
|
||||||
&& !EQUAL_POS(last_cursormoved, curwin->w_cursor)
|
|
||||||
# endif
|
|
||||||
# ifdef FEAT_INS_EXPAND
|
# ifdef FEAT_INS_EXPAND
|
||||||
&& !pum_visible()
|
&& !pum_visible()
|
||||||
# endif
|
# endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1654,7 +1636,6 @@ ins_redraw(
|
|||||||
if (syntax_present(curwin) && must_redraw)
|
if (syntax_present(curwin) && must_redraw)
|
||||||
update_screen(0);
|
update_screen(0);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (has_cursormovedI())
|
if (has_cursormovedI())
|
||||||
{
|
{
|
||||||
/* Make sure curswant is correct, an autocommand may call
|
/* Make sure curswant is correct, an autocommand may call
|
||||||
@ -1662,37 +1643,31 @@ ins_redraw(
|
|||||||
update_curswant();
|
update_curswant();
|
||||||
apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
if (curwin->w_p_cole > 0)
|
if (curwin->w_p_cole > 0)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
conceal_old_cursor_line = last_cursormoved.lnum;
|
conceal_old_cursor_line = last_cursormoved.lnum;
|
||||||
# endif
|
|
||||||
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
||||||
conceal_update_lines = TRUE;
|
conceal_update_lines = TRUE;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
last_cursormoved = curwin->w_cursor;
|
last_cursormoved = curwin->w_cursor;
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger TextChangedI if b_changedtick differs. */
|
/* Trigger TextChangedI if b_changedtick differs. */
|
||||||
if (ready && has_textchangedI()
|
if (ready && has_textchangedI()
|
||||||
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf)
|
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf)
|
||||||
# ifdef FEAT_INS_EXPAND
|
#ifdef FEAT_INS_EXPAND
|
||||||
&& !pum_visible()
|
&& !pum_visible()
|
||||||
# endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
|
||||||
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_INS_EXPAND
|
#ifdef FEAT_INS_EXPAND
|
||||||
/* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes
|
/* Trigger TextChangedP if b_changedtick differs. When the popupmenu closes
|
||||||
* TextChangedI will need to trigger for backwards compatibility, thus use
|
* TextChangedI will need to trigger for backwards compatibility, thus use
|
||||||
* different b_last_changedtick* variables. */
|
* different b_last_changedtick* variables. */
|
||||||
@ -1703,7 +1678,6 @@ ins_redraw(
|
|||||||
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf);
|
||||||
curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf);
|
curbuf->b_last_changedtick_pum = CHANGEDTICK(curbuf);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (must_redraw)
|
if (must_redraw)
|
||||||
@ -4001,19 +3975,15 @@ ins_compl_prep(int c)
|
|||||||
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
|
if (want_cindent && in_cinkeys(KEY_COMPLETE, ' ', inindent(0)))
|
||||||
do_c_expr_indent();
|
do_c_expr_indent();
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger the CompleteDone event to give scripts a chance to act
|
/* Trigger the CompleteDone event to give scripts a chance to act
|
||||||
* upon the completion. */
|
* upon the completion. */
|
||||||
apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
|
else if (ctrl_x_mode == CTRL_X_LOCAL_MSG)
|
||||||
/* Trigger the CompleteDone event to give scripts a chance to act
|
/* Trigger the CompleteDone event to give scripts a chance to act
|
||||||
* upon the (possibly failed) completion. */
|
* upon the (possibly failed) completion. */
|
||||||
apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_COMPLETEDONE, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* reset continue_* if we left expansion-mode, if we stay they'll be
|
/* reset continue_* if we left expansion-mode, if we stay they'll be
|
||||||
* (re)set properly in ins_complete() */
|
* (re)set properly in ins_complete() */
|
||||||
@ -6224,10 +6194,7 @@ insertchar(
|
|||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
&& !p_ri
|
&& !p_ri
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
&& !has_insertcharpre())
|
||||||
&& !has_insertcharpre()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#define INPUT_BUFLEN 100
|
#define INPUT_BUFLEN 100
|
||||||
char_u buf[INPUT_BUFLEN + 1];
|
char_u buf[INPUT_BUFLEN + 1];
|
||||||
@ -8404,7 +8371,7 @@ ins_reg(void)
|
|||||||
++no_u_sync;
|
++no_u_sync;
|
||||||
if (regname == '=')
|
if (regname == '=')
|
||||||
{
|
{
|
||||||
# ifdef FEAT_MBYTE
|
# ifdef HAVE_INPUT_METHOD
|
||||||
int im_on = im_get_status();
|
int im_on = im_get_status();
|
||||||
# endif
|
# endif
|
||||||
/* Sync undo when evaluating the expression calls setline() or
|
/* Sync undo when evaluating the expression calls setline() or
|
||||||
@ -8412,7 +8379,7 @@ ins_reg(void)
|
|||||||
u_sync_once = 2;
|
u_sync_once = 2;
|
||||||
|
|
||||||
regname = get_expr_register();
|
regname = get_expr_register();
|
||||||
# ifdef FEAT_MBYTE
|
# ifdef HAVE_INPUT_METHOD
|
||||||
/* Restore the Input Method. */
|
/* Restore the Input Method. */
|
||||||
if (im_on)
|
if (im_on)
|
||||||
im_set_active(TRUE);
|
im_set_active(TRUE);
|
||||||
@ -8541,12 +8508,12 @@ ins_ctrl_hat(void)
|
|||||||
{
|
{
|
||||||
curbuf->b_p_iminsert = B_IMODE_LMAP;
|
curbuf->b_p_iminsert = B_IMODE_LMAP;
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
im_set_active(FALSE);
|
im_set_active(FALSE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There are no ":lmap" mappings, toggle IM */
|
/* There are no ":lmap" mappings, toggle IM */
|
||||||
@ -8693,7 +8660,7 @@ ins_esc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
/* Disable IM to allow typing English directly for Normal mode commands.
|
/* Disable IM to allow typing English directly for Normal mode commands.
|
||||||
* When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
|
* When ":lmap" is enabled don't change 'iminsert' (IM can be enabled as
|
||||||
* well). */
|
* well). */
|
||||||
@ -8843,7 +8810,6 @@ ins_insert(int replaceState)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_INSERTMODE,
|
set_vim_var_string(VV_INSERTMODE,
|
||||||
(char_u *)((State & REPLACE_FLAG) ? "i" :
|
(char_u *)((State & REPLACE_FLAG) ? "i" :
|
||||||
@ -8853,7 +8819,6 @@ ins_insert(int replaceState)
|
|||||||
"r"), 1);
|
"r"), 1);
|
||||||
# endif
|
# endif
|
||||||
apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
if (State & REPLACE_FLAG)
|
if (State & REPLACE_FLAG)
|
||||||
State = INSERT | (State & LANGMAP);
|
State = INSERT | (State & LANGMAP);
|
||||||
else
|
else
|
||||||
@ -10573,7 +10538,7 @@ get_nolist_virtcol(void)
|
|||||||
return curwin->w_virtcol;
|
return curwin->w_virtcol;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
/*
|
/*
|
||||||
* Handle the InsertCharPre autocommand.
|
* Handle the InsertCharPre autocommand.
|
||||||
* "c" is the character that was typed.
|
* "c" is the character that was typed.
|
||||||
@ -10590,11 +10555,11 @@ do_insert_char_pre(int c)
|
|||||||
if (!has_insertcharpre())
|
if (!has_insertcharpre())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
# ifdef FEAT_MBYTE
|
||||||
if (has_mbyte)
|
if (has_mbyte)
|
||||||
buf[(*mb_char2bytes)(c, buf)] = NUL;
|
buf[(*mb_char2bytes)(c, buf)] = NUL;
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
{
|
{
|
||||||
buf[0] = c;
|
buf[0] = c;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
|
@ -5125,11 +5125,9 @@ garbage_collect(int testing)
|
|||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
abort = abort || set_ref_in_item(&wp->w_winvar.di_tv, copyID,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (aucmd_win != NULL)
|
if (aucmd_win != NULL)
|
||||||
abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID,
|
abort = abort || set_ref_in_item(&aucmd_win->w_winvar.di_tv, copyID,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* tabpage-local variables */
|
/* tabpage-local variables */
|
||||||
FOR_ALL_TABPAGES(tp)
|
FOR_ALL_TABPAGES(tp)
|
||||||
@ -6560,7 +6558,6 @@ v_throwpoint(char_u *oldval)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Set v:cmdarg.
|
* Set v:cmdarg.
|
||||||
* If "eap" != NULL, use "eap" to generate the value and return the old value.
|
* If "eap" != NULL, use "eap" to generate the value and return the old value.
|
||||||
@ -6618,7 +6615,7 @@ set_cmdarg(exarg_T *eap, char_u *oldarg)
|
|||||||
if (eap->force_ff != 0)
|
if (eap->force_ff != 0)
|
||||||
sprintf((char *)newval + STRLEN(newval), " ++ff=%s",
|
sprintf((char *)newval + STRLEN(newval), " ++ff=%s",
|
||||||
eap->cmd + eap->force_ff);
|
eap->cmd + eap->force_ff);
|
||||||
# ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
if (eap->force_enc != 0)
|
if (eap->force_enc != 0)
|
||||||
sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
|
sprintf((char *)newval + STRLEN(newval), " ++enc=%s",
|
||||||
eap->cmd + eap->force_enc);
|
eap->cmd + eap->force_enc);
|
||||||
@ -6628,11 +6625,10 @@ set_cmdarg(exarg_T *eap, char_u *oldarg)
|
|||||||
STRCPY(newval + STRLEN(newval), " ++bad=drop");
|
STRCPY(newval + STRLEN(newval), " ++bad=drop");
|
||||||
else if (eap->bad_char != 0)
|
else if (eap->bad_char != 0)
|
||||||
sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char);
|
sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char);
|
||||||
# endif
|
#endif
|
||||||
vimvars[VV_CMDARG].vv_str = newval;
|
vimvars[VV_CMDARG].vv_str = newval;
|
||||||
return oldval;
|
return oldval;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the value of internal variable "name".
|
* Get the value of internal variable "name".
|
||||||
|
@ -2668,9 +2668,7 @@ f_delete(typval_T *argvars, typval_T *rettv)
|
|||||||
static void
|
static void
|
||||||
f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
rettv->vval.v_number = did_filetype;
|
rettv->vval.v_number = did_filetype;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3053,12 +3051,10 @@ f_exists(typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
else if (*p == '#')
|
else if (*p == '#')
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (p[1] == '#')
|
if (p[1] == '#')
|
||||||
n = autocmd_supported(p + 2);
|
n = autocmd_supported(p + 2);
|
||||||
else
|
else
|
||||||
n = au_exists(p + 1);
|
n = au_exists(p + 1);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else /* internal variable */
|
else /* internal variable */
|
||||||
{
|
{
|
||||||
@ -5797,9 +5793,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
#ifdef FEAT_ARABIC
|
#ifdef FEAT_ARABIC
|
||||||
"arabic",
|
"arabic",
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
"autocmd",
|
"autocmd",
|
||||||
#endif
|
|
||||||
#ifdef FEAT_AUTOSERVERNAME
|
#ifdef FEAT_AUTOSERVERNAME
|
||||||
"autoservername",
|
"autoservername",
|
||||||
#endif
|
#endif
|
||||||
|
134
src/ex_cmds.c
134
src/ex_cmds.c
@ -28,9 +28,7 @@ static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int check_readonly(int *forceit, buf_T *buf);
|
static int check_readonly(int *forceit, buf_T *buf);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void delbuf_msg(char_u *name);
|
static void delbuf_msg(char_u *name);
|
||||||
#endif
|
|
||||||
static int
|
static int
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
_RTLENTRYF
|
_RTLENTRYF
|
||||||
@ -1148,9 +1146,7 @@ do_bang(
|
|||||||
/* Careful: This may recursively call do_bang() again! (because of
|
/* Careful: This may recursively call do_bang() again! (because of
|
||||||
* autocommands) */
|
* autocommands) */
|
||||||
do_filter(line1, line2, eap, newcmd, do_in, do_out);
|
do_filter(line1, line2, eap, newcmd, do_in, do_out);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (free_newcmd)
|
if (free_newcmd)
|
||||||
vim_free(newcmd);
|
vim_free(newcmd);
|
||||||
@ -1186,9 +1182,7 @@ do_filter(
|
|||||||
linenr_T read_linecount;
|
linenr_T read_linecount;
|
||||||
pos_T cursor_save;
|
pos_T cursor_save;
|
||||||
char_u *cmd_buf;
|
char_u *cmd_buf;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *old_curbuf = curbuf;
|
buf_T *old_curbuf = curbuf;
|
||||||
#endif
|
|
||||||
int shell_flags = 0;
|
int shell_flags = 0;
|
||||||
|
|
||||||
if (*cmd == NUL) /* no filter command */
|
if (*cmd == NUL) /* no filter command */
|
||||||
@ -1259,16 +1253,14 @@ do_filter(
|
|||||||
{
|
{
|
||||||
msg_putchar('\n'); /* keep message from buf_write() */
|
msg_putchar('\n'); /* keep message from buf_write() */
|
||||||
--no_wait_return;
|
--no_wait_return;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!aborting())
|
if (!aborting())
|
||||||
#endif
|
#endif
|
||||||
(void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */
|
(void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */
|
||||||
goto filterend;
|
goto filterend;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf != old_curbuf)
|
if (curbuf != old_curbuf)
|
||||||
goto filterend;
|
goto filterend;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!do_out)
|
if (!do_out)
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
@ -1334,7 +1326,7 @@ do_filter(
|
|||||||
if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM,
|
if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM,
|
||||||
eap, READ_FILTER) != OK)
|
eap, READ_FILTER) != OK)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!aborting())
|
if (!aborting())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -1343,10 +1335,8 @@ do_filter(
|
|||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf != old_curbuf)
|
if (curbuf != old_curbuf)
|
||||||
goto filterend;
|
goto filterend;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
read_linecount = curbuf->b_ml.ml_line_count - read_linecount;
|
read_linecount = curbuf->b_ml.ml_line_count - read_linecount;
|
||||||
@ -1426,13 +1416,11 @@ error:
|
|||||||
|
|
||||||
filterend:
|
filterend:
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf != old_curbuf)
|
if (curbuf != old_curbuf)
|
||||||
{
|
{
|
||||||
--no_wait_return;
|
--no_wait_return;
|
||||||
EMSG(_("E135: *Filter* Autocommands must not change current buffer"));
|
EMSG(_("E135: *Filter* Autocommands must not change current buffer"));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (itmp != NULL)
|
if (itmp != NULL)
|
||||||
mch_remove(itmp);
|
mch_remove(itmp);
|
||||||
if (otmp != NULL)
|
if (otmp != NULL)
|
||||||
@ -1482,9 +1470,7 @@ do_shell(
|
|||||||
* avoid having to type return below.
|
* avoid having to type return below.
|
||||||
*/
|
*/
|
||||||
msg_putchar('\r'); /* put cursor at start of line */
|
msg_putchar('\r'); /* put cursor at start of line */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!autocmd_busy)
|
if (!autocmd_busy)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
if (!winstart)
|
if (!winstart)
|
||||||
@ -1497,11 +1483,7 @@ do_shell(
|
|||||||
msg_putchar('\n'); /* may shift screen one line up */
|
msg_putchar('\n'); /* may shift screen one line up */
|
||||||
|
|
||||||
/* warning message before calling the shell */
|
/* warning message before calling the shell */
|
||||||
if (p_warn
|
if (p_warn && !autocmd_busy && msg_silent == 0)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !autocmd_busy
|
|
||||||
#endif
|
|
||||||
&& msg_silent == 0)
|
|
||||||
FOR_ALL_BUFFERS(buf)
|
FOR_ALL_BUFFERS(buf)
|
||||||
if (bufIsChangedNotTerm(buf))
|
if (bufIsChangedNotTerm(buf))
|
||||||
{
|
{
|
||||||
@ -1536,14 +1518,12 @@ do_shell(
|
|||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (autocmd_busy)
|
if (autocmd_busy)
|
||||||
{
|
{
|
||||||
if (msg_silent == 0)
|
if (msg_silent == 0)
|
||||||
redraw_later_clear();
|
redraw_later_clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* For ":sh" there is no need to call wait_return(), just redraw.
|
* For ":sh" there is no need to call wait_return(), just redraw.
|
||||||
@ -1612,9 +1592,7 @@ do_shell(
|
|||||||
/* display any error messages now */
|
/* display any error messages now */
|
||||||
display_errors();
|
display_errors();
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2979,16 +2957,14 @@ rename_buffer(char_u *new_fname)
|
|||||||
char_u *fname, *sfname, *xfname;
|
char_u *fname, *sfname, *xfname;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf = curbuf;
|
buf = curbuf;
|
||||||
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
|
||||||
/* buffer changed, don't change name now */
|
/* buffer changed, don't change name now */
|
||||||
if (buf != curbuf)
|
if (buf != curbuf)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* The name of the current buffer will be changed.
|
* The name of the current buffer will be changed.
|
||||||
@ -3017,9 +2993,8 @@ rename_buffer(char_u *new_fname)
|
|||||||
}
|
}
|
||||||
vim_free(fname);
|
vim_free(fname);
|
||||||
vim_free(sfname);
|
vim_free(sfname);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
/* Change directories when the 'acd' option is set. */
|
/* Change directories when the 'acd' option is set. */
|
||||||
DO_AUTOCHDIR
|
DO_AUTOCHDIR
|
||||||
return OK;
|
return OK;
|
||||||
@ -3198,22 +3173,20 @@ do_write(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
if (eap->cmdidx == CMD_saveas && alt_buf != NULL)
|
if (eap->cmdidx == CMD_saveas && alt_buf != NULL)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *was_curbuf = curbuf;
|
buf_T *was_curbuf = curbuf;
|
||||||
|
|
||||||
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf);
|
apply_autocmds(EVENT_BUFFILEPRE, NULL, NULL, FALSE, alt_buf);
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (curbuf != was_curbuf || aborting())
|
if (curbuf != was_curbuf || aborting())
|
||||||
# else
|
#else
|
||||||
if (curbuf != was_curbuf)
|
if (curbuf != was_curbuf)
|
||||||
# endif
|
#endif
|
||||||
{
|
{
|
||||||
/* buffer changed, don't change name now */
|
/* buffer changed, don't change name now */
|
||||||
retval = FAIL;
|
retval = FAIL;
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Exchange the file names for the current and the alternate
|
/* Exchange the file names for the current and the alternate
|
||||||
* buffer. This makes it look like we are now editing the buffer
|
* buffer. This makes it look like we are now editing the buffer
|
||||||
* under the new name. Must be done before buf_write(), because
|
* under the new name. Must be done before buf_write(), because
|
||||||
@ -3229,7 +3202,7 @@ do_write(exarg_T *eap)
|
|||||||
alt_buf->b_sfname = curbuf->b_sfname;
|
alt_buf->b_sfname = curbuf->b_sfname;
|
||||||
curbuf->b_sfname = fname;
|
curbuf->b_sfname = fname;
|
||||||
buf_name_changed(curbuf);
|
buf_name_changed(curbuf);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf);
|
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, alt_buf);
|
||||||
if (!alt_buf->b_p_bl)
|
if (!alt_buf->b_p_bl)
|
||||||
@ -3237,11 +3210,11 @@ do_write(exarg_T *eap)
|
|||||||
alt_buf->b_p_bl = TRUE;
|
alt_buf->b_p_bl = TRUE;
|
||||||
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf);
|
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, alt_buf);
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (curbuf != was_curbuf || aborting())
|
if (curbuf != was_curbuf || aborting())
|
||||||
# else
|
#else
|
||||||
if (curbuf != was_curbuf)
|
if (curbuf != was_curbuf)
|
||||||
# endif
|
#endif
|
||||||
{
|
{
|
||||||
/* buffer changed, don't write the file */
|
/* buffer changed, don't write the file */
|
||||||
retval = FAIL;
|
retval = FAIL;
|
||||||
@ -3260,7 +3233,6 @@ do_write(exarg_T *eap)
|
|||||||
/* Autocommands may have changed buffer names, esp. when
|
/* Autocommands may have changed buffer names, esp. when
|
||||||
* 'autochdir' is set. */
|
* 'autochdir' is set. */
|
||||||
fname = curbuf->b_sfname;
|
fname = curbuf->b_sfname;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
name_was_missing = curbuf->b_ffname == NULL;
|
name_was_missing = curbuf->b_ffname == NULL;
|
||||||
@ -3489,18 +3461,14 @@ do_wqall(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
if (buf_write_all(buf, eap->forceit) == FAIL)
|
if (buf_write_all(buf, eap->forceit) == FAIL)
|
||||||
++error;
|
++error;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* an autocommand may have deleted the buffer */
|
/* an autocommand may have deleted the buffer */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
buf = firstbuf;
|
buf = firstbuf;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
eap->forceit = save_forceit; /* check_overwrite() may set it */
|
eap->forceit = save_forceit; /* check_overwrite() may set it */
|
||||||
}
|
}
|
||||||
@ -3604,10 +3572,8 @@ getfile(
|
|||||||
|
|
||||||
if (text_locked())
|
if (text_locked())
|
||||||
return GETFILE_ERROR;
|
return GETFILE_ERROR;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
return GETFILE_ERROR;
|
return GETFILE_ERROR;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fnum == 0)
|
if (fnum == 0)
|
||||||
{
|
{
|
||||||
@ -3702,17 +3668,15 @@ do_ecmd(
|
|||||||
{
|
{
|
||||||
int other_file; /* TRUE if editing another file */
|
int other_file; /* TRUE if editing another file */
|
||||||
int oldbuf; /* TRUE if using existing buffer */
|
int oldbuf; /* TRUE if using existing buffer */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int auto_buf = FALSE; /* TRUE if autocommands brought us
|
int auto_buf = FALSE; /* TRUE if autocommands brought us
|
||||||
into the buffer unexpectedly */
|
into the buffer unexpectedly */
|
||||||
char_u *new_name = NULL;
|
char_u *new_name = NULL;
|
||||||
|
#if defined(FEAT_EVAL)
|
||||||
int did_set_swapcommand = FALSE;
|
int did_set_swapcommand = FALSE;
|
||||||
#endif
|
#endif
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
||||||
bufref_T old_curbuf;
|
bufref_T old_curbuf;
|
||||||
#endif
|
|
||||||
char_u *free_fname = NULL;
|
char_u *free_fname = NULL;
|
||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
char_u *browse_file = NULL;
|
char_u *browse_file = NULL;
|
||||||
@ -3736,9 +3700,7 @@ do_ecmd(
|
|||||||
|
|
||||||
if (eap != NULL)
|
if (eap != NULL)
|
||||||
command = eap->do_ecmd_cmd;
|
command = eap->do_ecmd_cmd;
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
||||||
set_bufref(&old_curbuf, curbuf);
|
set_bufref(&old_curbuf, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fnum != 0)
|
if (fnum != 0)
|
||||||
{
|
{
|
||||||
@ -3751,11 +3713,10 @@ do_ecmd(
|
|||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
if (cmdmod.browse)
|
if (cmdmod.browse)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (
|
if (
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
!gui.in_use &&
|
!gui.in_use &&
|
||||||
# endif
|
# endif
|
||||||
au_has_group((char_u *)"FileExplorer"))
|
au_has_group((char_u *)"FileExplorer"))
|
||||||
{
|
{
|
||||||
/* No browsing supported but we do have the file explorer:
|
/* No browsing supported but we do have the file explorer:
|
||||||
@ -3764,7 +3725,6 @@ do_ecmd(
|
|||||||
ffname = (char_u *)".";
|
ffname = (char_u *)".";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
browse_file = do_browse(0, (char_u *)_("Edit File"), ffname,
|
browse_file = do_browse(0, (char_u *)_("Edit File"), ffname,
|
||||||
NULL, NULL, NULL, curbuf);
|
NULL, NULL, NULL, curbuf);
|
||||||
@ -3838,7 +3798,7 @@ do_ecmd(
|
|||||||
*/
|
*/
|
||||||
reset_VIsual();
|
reset_VIsual();
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
if ((command != NULL || newlnum > (linenr_T)0)
|
if ((command != NULL || newlnum > (linenr_T)0)
|
||||||
&& *get_vim_var_str(VV_SWAPCOMMAND) == NUL)
|
&& *get_vim_var_str(VV_SWAPCOMMAND) == NUL)
|
||||||
{
|
{
|
||||||
@ -3901,12 +3861,11 @@ do_ecmd(
|
|||||||
#endif
|
#endif
|
||||||
buf = buflist_new(ffname, sfname, 0L,
|
buf = buflist_new(ffname, sfname, 0L,
|
||||||
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
|
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* autocommands may change curwin and curbuf */
|
/* autocommands may change curwin and curbuf */
|
||||||
if (oldwin != NULL)
|
if (oldwin != NULL)
|
||||||
oldwin = curwin;
|
oldwin = curwin;
|
||||||
set_bufref(&old_curbuf, curbuf);
|
set_bufref(&old_curbuf, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
goto theend;
|
goto theend;
|
||||||
@ -3921,11 +3880,7 @@ do_ecmd(
|
|||||||
(void)buf_check_timestamp(buf, FALSE);
|
(void)buf_check_timestamp(buf, FALSE);
|
||||||
/* Check if autocommands made the buffer invalid or changed the
|
/* Check if autocommands made the buffer invalid or changed the
|
||||||
* current buffer. */
|
* current buffer. */
|
||||||
if (!bufref_valid(&bufref)
|
if (!bufref_valid(&bufref) || curbuf != old_curbuf.br_buf)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
|| curbuf != old_curbuf.br_buf
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
goto theend;
|
goto theend;
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
@ -3950,7 +3905,6 @@ do_ecmd(
|
|||||||
*/
|
*/
|
||||||
if (buf != curbuf)
|
if (buf != curbuf)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Be careful: The autocommands may delete any buffer and change
|
* Be careful: The autocommands may delete any buffer and change
|
||||||
* the current buffer.
|
* the current buffer.
|
||||||
@ -3971,13 +3925,13 @@ do_ecmd(
|
|||||||
delbuf_msg(new_name); /* frees new_name */
|
delbuf_msg(new_name); /* frees new_name */
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
{
|
{
|
||||||
vim_free(new_name);
|
vim_free(new_name);
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
if (buf == curbuf) /* already in new buffer */
|
if (buf == curbuf) /* already in new buffer */
|
||||||
auto_buf = TRUE;
|
auto_buf = TRUE;
|
||||||
else
|
else
|
||||||
@ -3990,7 +3944,6 @@ do_ecmd(
|
|||||||
++buf->b_locked;
|
++buf->b_locked;
|
||||||
|
|
||||||
if (curbuf == old_curbuf.br_buf)
|
if (curbuf == old_curbuf.br_buf)
|
||||||
#endif
|
|
||||||
buf_copy_options(buf, BCO_ENTER);
|
buf_copy_options(buf, BCO_ENTER);
|
||||||
|
|
||||||
/* Close the link to the current buffer. This will set
|
/* Close the link to the current buffer. This will set
|
||||||
@ -3999,18 +3952,17 @@ do_ecmd(
|
|||||||
close_buffer(oldwin, curbuf,
|
close_buffer(oldwin, curbuf,
|
||||||
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
|
(flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD, FALSE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
the_curwin->w_closing = FALSE;
|
the_curwin->w_closing = FALSE;
|
||||||
--buf->b_locked;
|
--buf->b_locked;
|
||||||
|
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/* autocmds may abort script processing */
|
/* autocmds may abort script processing */
|
||||||
if (aborting() && curwin->w_buffer != NULL)
|
if (aborting() && curwin->w_buffer != NULL)
|
||||||
{
|
{
|
||||||
vim_free(new_name);
|
vim_free(new_name);
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
/* Be careful again, like above. */
|
/* Be careful again, like above. */
|
||||||
if (!bufref_valid(&au_new_curbuf))
|
if (!bufref_valid(&au_new_curbuf))
|
||||||
{
|
{
|
||||||
@ -4021,7 +3973,6 @@ do_ecmd(
|
|||||||
if (buf == curbuf) /* already in new buffer */
|
if (buf == curbuf) /* already in new buffer */
|
||||||
auto_buf = TRUE;
|
auto_buf = TRUE;
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
/*
|
/*
|
||||||
@ -4054,13 +4005,10 @@ do_ecmd(
|
|||||||
#ifdef FEAT_SPELL
|
#ifdef FEAT_SPELL
|
||||||
did_get_winopts = TRUE;
|
did_get_winopts = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
}
|
}
|
||||||
vim_free(new_name);
|
vim_free(new_name);
|
||||||
au_new_curbuf.br_buf = NULL;
|
au_new_curbuf.br_buf = NULL;
|
||||||
au_new_curbuf.br_buf_free_count = 0;
|
au_new_curbuf.br_buf_free_count = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_pcmark.lnum = 1;
|
curwin->w_pcmark.lnum = 1;
|
||||||
@ -4083,9 +4031,7 @@ do_ecmd(
|
|||||||
++RedrawingDisabled;
|
++RedrawingDisabled;
|
||||||
did_inc_redrawing_disabled = TRUE;
|
did_inc_redrawing_disabled = TRUE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf = curbuf;
|
buf = curbuf;
|
||||||
#endif
|
|
||||||
if ((flags & ECMD_SET_HELP) || keep_help_flag)
|
if ((flags & ECMD_SET_HELP) || keep_help_flag)
|
||||||
{
|
{
|
||||||
prepare_help_buffer();
|
prepare_help_buffer();
|
||||||
@ -4098,21 +4044,19 @@ do_ecmd(
|
|||||||
set_buflisted(TRUE);
|
set_buflisted(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If autocommands change buffers under our fingers, forget about
|
/* If autocommands change buffers under our fingers, forget about
|
||||||
* editing the file. */
|
* editing the file. */
|
||||||
if (buf != curbuf)
|
if (buf != curbuf)
|
||||||
goto theend;
|
goto theend;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
goto theend;
|
goto theend;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* Since we are starting to edit a file, consider the filetype to be
|
/* Since we are starting to edit a file, consider the filetype to be
|
||||||
* unset. Helps for when an autocommand changes files and expects syntax
|
* unset. Helps for when an autocommand changes files and expects syntax
|
||||||
* highlighting to work in the other file. */
|
* highlighting to work in the other file. */
|
||||||
did_filetype = FALSE;
|
did_filetype = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* other_file oldbuf
|
* other_file oldbuf
|
||||||
@ -4129,14 +4073,13 @@ do_ecmd(
|
|||||||
newlnum = curwin->w_cursor.lnum;
|
newlnum = curwin->w_cursor.lnum;
|
||||||
solcol = curwin->w_cursor.col;
|
solcol = curwin->w_cursor.col;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf = curbuf;
|
buf = curbuf;
|
||||||
if (buf->b_fname != NULL)
|
if (buf->b_fname != NULL)
|
||||||
new_name = vim_strsave(buf->b_fname);
|
new_name = vim_strsave(buf->b_fname);
|
||||||
else
|
else
|
||||||
new_name = NULL;
|
new_name = NULL;
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur)
|
if (p_ur < 0 || curbuf->b_ml.ml_line_count <= p_ur)
|
||||||
{
|
{
|
||||||
/* Save all the text, so that the reload can be undone.
|
/* Save all the text, so that the reload can be undone.
|
||||||
@ -4145,9 +4088,7 @@ do_ecmd(
|
|||||||
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
|
if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE)
|
||||||
== FAIL)
|
== FAIL)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
vim_free(new_name);
|
vim_free(new_name);
|
||||||
#endif
|
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
u_unchanged(curbuf);
|
u_unchanged(curbuf);
|
||||||
@ -4158,7 +4099,7 @@ do_ecmd(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
buf_freeall(curbuf, 0); /* free all things for buffer */
|
buf_freeall(curbuf, 0); /* free all things for buffer */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If autocommands deleted the buffer we were going to re-edit, give
|
/* If autocommands deleted the buffer we were going to re-edit, give
|
||||||
* up and jump to the end. */
|
* up and jump to the end. */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
@ -4173,10 +4114,9 @@ do_ecmd(
|
|||||||
* the autocommands changed the buffer... */
|
* the autocommands changed the buffer... */
|
||||||
if (buf != curbuf)
|
if (buf != curbuf)
|
||||||
goto theend;
|
goto theend;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
goto theend;
|
goto theend;
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
buf_clear_file(curbuf);
|
buf_clear_file(curbuf);
|
||||||
curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */
|
curbuf->b_op_start.lnum = 0; /* clear '[ and '] marks */
|
||||||
@ -4194,9 +4134,7 @@ do_ecmd(
|
|||||||
*/
|
*/
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!auto_buf)
|
if (!auto_buf)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Set cursor and init window before reading the file and executing
|
* Set cursor and init window before reading the file and executing
|
||||||
@ -4237,7 +4175,7 @@ do_ecmd(
|
|||||||
/*
|
/*
|
||||||
* Open the buffer and read the file.
|
* Open the buffer and read the file.
|
||||||
*/
|
*/
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (should_abort(open_buffer(FALSE, eap, readfile_flags)))
|
if (should_abort(open_buffer(FALSE, eap, readfile_flags)))
|
||||||
retval = FAIL;
|
retval = FAIL;
|
||||||
#else
|
#else
|
||||||
@ -4250,7 +4188,6 @@ do_ecmd(
|
|||||||
handle_swap_exists(&old_curbuf);
|
handle_swap_exists(&old_curbuf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Read the modelines, but only to set window-local options. Any
|
/* Read the modelines, but only to set window-local options. Any
|
||||||
@ -4264,7 +4201,6 @@ do_ecmd(
|
|||||||
&retval);
|
&retval);
|
||||||
}
|
}
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If autocommands change the cursor position or topline, we should
|
/* If autocommands change the cursor position or topline, we should
|
||||||
* keep it. Also when it moves within a line. */
|
* keep it. Also when it moves within a line. */
|
||||||
@ -4342,11 +4278,7 @@ do_ecmd(
|
|||||||
* Did not read the file, need to show some info about the file.
|
* Did not read the file, need to show some info about the file.
|
||||||
* Do this after setting the cursor.
|
* Do this after setting the cursor.
|
||||||
*/
|
*/
|
||||||
if (oldbuf
|
if (oldbuf && !auto_buf)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !auto_buf
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int msg_scroll_save = msg_scroll;
|
int msg_scroll_save = msg_scroll;
|
||||||
|
|
||||||
@ -4430,7 +4362,7 @@ do_ecmd(
|
|||||||
theend:
|
theend:
|
||||||
if (did_inc_redrawing_disabled)
|
if (did_inc_redrawing_disabled)
|
||||||
--RedrawingDisabled;
|
--RedrawingDisabled;
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
if (did_set_swapcommand)
|
if (did_set_swapcommand)
|
||||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||||
#endif
|
#endif
|
||||||
@ -4441,7 +4373,6 @@ theend:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void
|
static void
|
||||||
delbuf_msg(char_u *name)
|
delbuf_msg(char_u *name)
|
||||||
{
|
{
|
||||||
@ -4451,7 +4382,6 @@ delbuf_msg(char_u *name)
|
|||||||
au_new_curbuf.br_buf = NULL;
|
au_new_curbuf.br_buf = NULL;
|
||||||
au_new_curbuf.br_buf_free_count = 0;
|
au_new_curbuf.br_buf_free_count = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int append_indent = 0; /* autoindent for first line */
|
static int append_indent = 0; /* autoindent for first line */
|
||||||
|
|
||||||
@ -5156,7 +5086,7 @@ do_sub(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
line2 = eap->line2;
|
line2 = eap->line2;
|
||||||
for (lnum = eap->line1; lnum <= line2 && !(got_quit
|
for (lnum = eap->line1; lnum <= line2 && !(got_quit
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD)
|
#if defined(FEAT_EVAL)
|
||||||
|| aborting()
|
|| aborting()
|
||||||
#endif
|
#endif
|
||||||
); ++lnum)
|
); ++lnum)
|
||||||
@ -6870,7 +6800,6 @@ fix_help_buffer(void)
|
|||||||
char_u *rt;
|
char_u *rt;
|
||||||
int mustfree;
|
int mustfree;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Set filetype to "help" if still needed. */
|
/* Set filetype to "help" if still needed. */
|
||||||
if (STRCMP(curbuf->b_p_ft, "help") != 0)
|
if (STRCMP(curbuf->b_p_ft, "help") != 0)
|
||||||
{
|
{
|
||||||
@ -6878,7 +6807,6 @@ fix_help_buffer(void)
|
|||||||
set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
|
set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
|
||||||
--curbuf_lock;
|
--curbuf_lock;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
if (!syntax_present(curwin))
|
if (!syntax_present(curwin))
|
||||||
|
@ -2045,17 +2045,15 @@ autowrite_all(void)
|
|||||||
FOR_ALL_BUFFERS(buf)
|
FOR_ALL_BUFFERS(buf)
|
||||||
if (bufIsChanged(buf) && !buf->b_p_ro)
|
if (bufIsChanged(buf) && !buf->b_p_ro)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
(void)buf_write_all(buf, FALSE);
|
(void)buf_write_all(buf, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* an autocommand may have deleted the buffer */
|
/* an autocommand may have deleted the buffer */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
buf = firstbuf;
|
buf = firstbuf;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2067,11 +2065,9 @@ autowrite_all(void)
|
|||||||
check_changed(buf_T *buf, int flags)
|
check_changed(buf_T *buf, int flags)
|
||||||
{
|
{
|
||||||
int forceit = (flags & CCGD_FORCEIT);
|
int forceit = (flags & CCGD_FORCEIT);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( !forceit
|
if ( !forceit
|
||||||
&& bufIsChanged(buf)
|
&& bufIsChanged(buf)
|
||||||
@ -2093,17 +2089,15 @@ check_changed(buf_T *buf, int flags)
|
|||||||
# endif
|
# endif
|
||||||
))
|
))
|
||||||
++count;
|
++count;
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
/* Autocommand deleted buffer, oops! It's not changed now. */
|
/* Autocommand deleted buffer, oops! It's not changed now. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
# endif
|
|
||||||
dialog_changed(buf, count > 1);
|
dialog_changed(buf, count > 1);
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
/* Autocommand deleted buffer, oops! It's not changed now. */
|
/* Autocommand deleted buffer, oops! It's not changed now. */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
# endif
|
|
||||||
return bufIsChanged(buf);
|
return bufIsChanged(buf);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2197,11 +2191,9 @@ dialog_changed(
|
|||||||
)
|
)
|
||||||
&& !buf2->b_p_ro)
|
&& !buf2->b_p_ro)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf2);
|
set_bufref(&bufref, buf2);
|
||||||
#endif
|
|
||||||
#ifdef FEAT_BROWSE
|
#ifdef FEAT_BROWSE
|
||||||
/* May get file name, when there is none */
|
/* May get file name, when there is none */
|
||||||
browse_save_fname(buf2);
|
browse_save_fname(buf2);
|
||||||
@ -2210,11 +2202,10 @@ dialog_changed(
|
|||||||
buf2->b_fname, buf2->b_ffname, FALSE) == OK)
|
buf2->b_fname, buf2->b_ffname, FALSE) == OK)
|
||||||
/* didn't hit Cancel */
|
/* didn't hit Cancel */
|
||||||
(void)buf_write_all(buf2, FALSE);
|
(void)buf_write_all(buf2, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* an autocommand may have deleted the buffer */
|
/* an autocommand may have deleted the buffer */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
buf2 = firstbuf;
|
buf2 = firstbuf;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2370,19 +2361,15 @@ check_changed_any(
|
|||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
if (wp->w_buffer == buf)
|
if (wp->w_buffer == buf)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
goto_tabpage_win(tp, wp);
|
goto_tabpage_win(tp, wp);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Paranoia: did autocms wipe out the buffer with changes? */
|
/* Paranoia: did autocms wipe out the buffer with changes? */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
{
|
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
goto buf_found;
|
goto buf_found;
|
||||||
}
|
}
|
||||||
buf_found:
|
buf_found:
|
||||||
@ -2420,20 +2407,16 @@ check_fname(void)
|
|||||||
buf_write_all(buf_T *buf, int forceit)
|
buf_write_all(buf_T *buf, int forceit)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *old_curbuf = curbuf;
|
buf_T *old_curbuf = curbuf;
|
||||||
#endif
|
|
||||||
|
|
||||||
retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
|
retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
|
||||||
(linenr_T)1, buf->b_ml.ml_line_count, NULL,
|
(linenr_T)1, buf->b_ml.ml_line_count, NULL,
|
||||||
FALSE, forceit, TRUE, FALSE));
|
FALSE, forceit, TRUE, FALSE));
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf != old_curbuf)
|
if (curbuf != old_curbuf)
|
||||||
{
|
{
|
||||||
msg_source(HL_ATTR(HLF_W));
|
msg_source(HL_ATTR(HLF_W));
|
||||||
MSG(_("Warning: Entered other buffer unexpectedly (check autocommands)"));
|
MSG(_("Warning: Entered other buffer unexpectedly (check autocommands)"));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3053,7 +3036,7 @@ ex_listdo(exarg_T *eap)
|
|||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
buf_T *buf = curbuf;
|
buf_T *buf = curbuf;
|
||||||
int next_fnum = 0;
|
int next_fnum = 0;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
char_u *save_ei = NULL;
|
char_u *save_ei = NULL;
|
||||||
#endif
|
#endif
|
||||||
char_u *p_shm_save;
|
char_u *p_shm_save;
|
||||||
@ -3071,7 +3054,7 @@ ex_listdo(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
|
if (eap->cmdidx != CMD_windo && eap->cmdidx != CMD_tabdo)
|
||||||
/* Don't do syntax HL autocommands. Skipping the syntax file is a
|
/* Don't do syntax HL autocommands. Skipping the syntax file is a
|
||||||
* great speed improvement. */
|
* great speed improvement. */
|
||||||
@ -3265,7 +3248,7 @@ ex_listdo(exarg_T *eap)
|
|||||||
listcmd_busy = FALSE;
|
listcmd_busy = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
if (save_ei != NULL)
|
if (save_ei != NULL)
|
||||||
{
|
{
|
||||||
au_event_restore(save_ei);
|
au_event_restore(save_ei);
|
||||||
@ -3660,6 +3643,8 @@ source_in_path(char_u *path, char_u *name, int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expand wildcards in "pat" and invoke do_source() for each match.
|
* Expand wildcards in "pat" and invoke do_source() for each match.
|
||||||
*/
|
*/
|
||||||
@ -3800,7 +3785,6 @@ load_pack_plugin(char_u *fname)
|
|||||||
vim_snprintf((char *)pat, len, plugpat, ffname);
|
vim_snprintf((char *)pat, len, plugpat, ffname);
|
||||||
source_all_matches(pat);
|
source_all_matches(pat);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{
|
{
|
||||||
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
|
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
|
||||||
|
|
||||||
@ -3815,7 +3799,6 @@ load_pack_plugin(char_u *fname)
|
|||||||
}
|
}
|
||||||
vim_free(cmd);
|
vim_free(cmd);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
vim_free(pat);
|
vim_free(pat);
|
||||||
retval = OK;
|
retval = OK;
|
||||||
|
|
||||||
@ -3911,8 +3894,9 @@ ex_packadd(exarg_T *eap)
|
|||||||
vim_free(pat);
|
vim_free(pat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* ":options"
|
* ":options"
|
||||||
*/
|
*/
|
||||||
@ -4308,23 +4292,21 @@ do_source(
|
|||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Apply SourceCmd autocommands, they should get the file and source it. */
|
/* Apply SourceCmd autocommands, they should get the file and source it. */
|
||||||
if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
|
if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
|
||||||
&& apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp,
|
&& apply_autocmds(EVENT_SOURCECMD, fname_exp, fname_exp,
|
||||||
FALSE, curbuf))
|
FALSE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
retval = aborting() ? FAIL : OK;
|
retval = aborting() ? FAIL : OK;
|
||||||
# else
|
#else
|
||||||
retval = OK;
|
retval = OK;
|
||||||
# endif
|
#endif
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply SourcePre autocommands, they may get the file. */
|
/* Apply SourcePre autocommands, they may get the file. */
|
||||||
apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
|
apply_autocmds(EVENT_SOURCEPRE, fname_exp, fname_exp, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_FOPEN_NOINH
|
#ifdef USE_FOPEN_NOINH
|
||||||
cookie.fp = fopen_noinh_readbin((char *)fname_exp);
|
cookie.fp = fopen_noinh_readbin((char *)fname_exp);
|
||||||
|
110
src/ex_docmd.c
110
src/ex_docmd.c
@ -81,14 +81,8 @@ static void ex_abclear(exarg_T *eap);
|
|||||||
# define ex_menu ex_ni
|
# define ex_menu ex_ni
|
||||||
# define ex_menutranslate ex_ni
|
# define ex_menutranslate ex_ni
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void ex_autocmd(exarg_T *eap);
|
static void ex_autocmd(exarg_T *eap);
|
||||||
static void ex_doautocmd(exarg_T *eap);
|
static void ex_doautocmd(exarg_T *eap);
|
||||||
#else
|
|
||||||
# define ex_autocmd ex_ni
|
|
||||||
# define ex_doautocmd ex_ni
|
|
||||||
# define ex_doautoall ex_ni
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_LISTCMDS
|
#ifdef FEAT_LISTCMDS
|
||||||
static void ex_bunload(exarg_T *eap);
|
static void ex_bunload(exarg_T *eap);
|
||||||
static void ex_buffer(exarg_T *eap);
|
static void ex_buffer(exarg_T *eap);
|
||||||
@ -234,6 +228,10 @@ static void ex_popup(exarg_T *eap);
|
|||||||
# define ex_syntax ex_ni
|
# define ex_syntax ex_ni
|
||||||
# define ex_ownsyntax ex_ni
|
# define ex_ownsyntax ex_ni
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FEAT_EVAL
|
||||||
|
# define ex_packadd ex_ni
|
||||||
|
# define ex_packloadall ex_ni
|
||||||
|
#endif
|
||||||
#if !defined(FEAT_SYN_HL) || !defined(FEAT_PROFILE)
|
#if !defined(FEAT_SYN_HL) || !defined(FEAT_PROFILE)
|
||||||
# define ex_syntime ex_ni
|
# define ex_syntime ex_ni
|
||||||
#endif
|
#endif
|
||||||
@ -390,13 +388,8 @@ static void ex_viminfo(exarg_T *eap);
|
|||||||
# define ex_viminfo ex_ni
|
# define ex_viminfo ex_ni
|
||||||
#endif
|
#endif
|
||||||
static void ex_behave(exarg_T *eap);
|
static void ex_behave(exarg_T *eap);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void ex_filetype(exarg_T *eap);
|
static void ex_filetype(exarg_T *eap);
|
||||||
static void ex_setfiletype(exarg_T *eap);
|
static void ex_setfiletype(exarg_T *eap);
|
||||||
#else
|
|
||||||
# define ex_filetype ex_ni
|
|
||||||
# define ex_setfiletype ex_ni
|
|
||||||
#endif
|
|
||||||
#ifndef FEAT_DIFF
|
#ifndef FEAT_DIFF
|
||||||
# define ex_diffoff ex_ni
|
# define ex_diffoff ex_ni
|
||||||
# define ex_diffpatch ex_ni
|
# define ex_diffpatch ex_ni
|
||||||
@ -407,7 +400,7 @@ static void ex_setfiletype(exarg_T *eap);
|
|||||||
#endif
|
#endif
|
||||||
static void ex_digraphs(exarg_T *eap);
|
static void ex_digraphs(exarg_T *eap);
|
||||||
static void ex_set(exarg_T *eap);
|
static void ex_set(exarg_T *eap);
|
||||||
#if !defined(FEAT_EVAL) || !defined(FEAT_AUTOCMD)
|
#if !defined(FEAT_EVAL)
|
||||||
# define ex_options ex_ni
|
# define ex_options ex_ni
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
@ -1761,11 +1754,8 @@ do_one_cmd(
|
|||||||
/* avoid that a function call in 'statusline' does this */
|
/* avoid that a function call in 'statusline' does this */
|
||||||
&& !getline_equal(fgetline, cookie, get_func_line)
|
&& !getline_equal(fgetline, cookie, get_func_line)
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* avoid that an autocommand, e.g. QuitPre, does this */
|
/* avoid that an autocommand, e.g. QuitPre, does this */
|
||||||
&& !getline_equal(fgetline, cookie, getnextac)
|
&& !getline_equal(fgetline, cookie, getnextac))
|
||||||
#endif
|
|
||||||
)
|
|
||||||
--quitmore;
|
--quitmore;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1912,7 +1902,6 @@ do_one_cmd(
|
|||||||
|
|
||||||
case 'n': if (checkforcmd(&ea.cmd, "noautocmd", 3))
|
case 'n': if (checkforcmd(&ea.cmd, "noautocmd", 3))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (cmdmod.save_ei == NULL)
|
if (cmdmod.save_ei == NULL)
|
||||||
{
|
{
|
||||||
/* Set 'eventignore' to "all". Restore the
|
/* Set 'eventignore' to "all". Restore the
|
||||||
@ -1921,7 +1910,6 @@ do_one_cmd(
|
|||||||
set_string_option_direct((char_u *)"ei", -1,
|
set_string_option_direct((char_u *)"ei", -1,
|
||||||
(char_u *)"all", OPT_FREE, SID_NONE);
|
(char_u *)"all", OPT_FREE, SID_NONE);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!checkforcmd(&ea.cmd, "noswapfile", 3))
|
if (!checkforcmd(&ea.cmd, "noswapfile", 3))
|
||||||
@ -2302,7 +2290,6 @@ do_one_cmd(
|
|||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If this looks like an undefined user command and there are CmdUndefined
|
/* If this looks like an undefined user command and there are CmdUndefined
|
||||||
* autocommands defined, trigger the matching autocommands. */
|
* autocommands defined, trigger the matching autocommands. */
|
||||||
if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip
|
if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip
|
||||||
@ -2319,9 +2306,12 @@ do_one_cmd(
|
|||||||
vim_free(p);
|
vim_free(p);
|
||||||
/* If the autocommands did something and didn't cause an error, try
|
/* If the autocommands did something and didn't cause an error, try
|
||||||
* finding the command again. */
|
* finding the command again. */
|
||||||
p = (ret && !aborting()) ? find_command(&ea, NULL) : ea.cmd;
|
p = (ret
|
||||||
}
|
#ifdef FEAT_EVAL
|
||||||
|
&& !aborting()
|
||||||
#endif
|
#endif
|
||||||
|
) ? find_command(&ea, NULL) : ea.cmd;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_USR_CMDS
|
#ifdef FEAT_USR_CMDS
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
@ -2421,7 +2411,6 @@ do_one_cmd(
|
|||||||
errormsg = (char_u *)_(get_text_locked_msg());
|
errormsg = (char_u *)_(get_text_locked_msg());
|
||||||
goto doend;
|
goto doend;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Disallow editing another buffer when "curbuf_lock" is set.
|
/* Disallow editing another buffer when "curbuf_lock" is set.
|
||||||
* Do allow ":edit" (check for argument later).
|
* Do allow ":edit" (check for argument later).
|
||||||
* Do allow ":checktime" (it's postponed). */
|
* Do allow ":checktime" (it's postponed). */
|
||||||
@ -2431,7 +2420,6 @@ do_one_cmd(
|
|||||||
&& !IS_USER_CMDIDX(ea.cmdidx)
|
&& !IS_USER_CMDIDX(ea.cmdidx)
|
||||||
&& curbuf_locked())
|
&& curbuf_locked())
|
||||||
goto doend;
|
goto doend;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0)
|
if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0)
|
||||||
{
|
{
|
||||||
@ -2971,7 +2959,7 @@ doend:
|
|||||||
|
|
||||||
if (verbose_save >= 0)
|
if (verbose_save >= 0)
|
||||||
p_verbose = verbose_save;
|
p_verbose = verbose_save;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (cmdmod.save_ei != NULL)
|
if (cmdmod.save_ei != NULL)
|
||||||
{
|
{
|
||||||
/* Restore 'eventignore' to the value before ":noautocmd". */
|
/* Restore 'eventignore' to the value before ":noautocmd". */
|
||||||
@ -2979,7 +2967,7 @@ doend:
|
|||||||
OPT_FREE, SID_NONE);
|
OPT_FREE, SID_NONE);
|
||||||
free_string_option(cmdmod.save_ei);
|
free_string_option(cmdmod.save_ei);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (cmdmod.filter_regmatch.regprog != NULL)
|
if (cmdmod.filter_regmatch.regprog != NULL)
|
||||||
vim_regfree(cmdmod.filter_regmatch.regprog);
|
vim_regfree(cmdmod.filter_regmatch.regprog);
|
||||||
|
|
||||||
@ -4025,14 +4013,12 @@ set_one_cmd_context(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case CMD_autocmd:
|
case CMD_autocmd:
|
||||||
return set_context_in_autocmd(xp, arg, FALSE);
|
return set_context_in_autocmd(xp, arg, FALSE);
|
||||||
|
|
||||||
case CMD_doautocmd:
|
case CMD_doautocmd:
|
||||||
case CMD_doautoall:
|
case CMD_doautoall:
|
||||||
return set_context_in_autocmd(xp, arg, TRUE);
|
return set_context_in_autocmd(xp, arg, TRUE);
|
||||||
#endif
|
|
||||||
case CMD_set:
|
case CMD_set:
|
||||||
set_context_in_set_cmd(xp, arg, 0);
|
set_context_in_set_cmd(xp, arg, 0);
|
||||||
break;
|
break;
|
||||||
@ -5500,7 +5486,6 @@ ex_abclear(exarg_T *eap)
|
|||||||
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
static void
|
static void
|
||||||
ex_autocmd(exarg_T *eap)
|
ex_autocmd(exarg_T *eap)
|
||||||
{
|
{
|
||||||
@ -5534,7 +5519,6 @@ ex_doautocmd(exarg_T *eap)
|
|||||||
if (call_do_modelines && did_aucmd)
|
if (call_do_modelines && did_aucmd)
|
||||||
do_modelines(0);
|
do_modelines(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_LISTCMDS
|
#ifdef FEAT_LISTCMDS
|
||||||
/*
|
/*
|
||||||
@ -7234,7 +7218,6 @@ ex_quit(exarg_T *eap)
|
|||||||
else
|
else
|
||||||
wp = curwin;
|
wp = curwin;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Refuse to quit when locked. */
|
/* Refuse to quit when locked. */
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
return;
|
return;
|
||||||
@ -7245,7 +7228,6 @@ ex_quit(exarg_T *eap)
|
|||||||
if (!win_valid(wp)
|
if (!win_valid(wp)
|
||||||
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
|
|| (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
netbeansForcedQuit = eap->forceit;
|
netbeansForcedQuit = eap->forceit;
|
||||||
@ -7318,13 +7300,11 @@ ex_quit_all(exarg_T *eap)
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
|
||||||
/* Refuse to quit when locked or when the buffer in the last window is
|
/* Refuse to quit when locked or when the buffer in the last window is
|
||||||
* being closed (can only happen in autocommands). */
|
* being closed (can only happen in autocommands). */
|
||||||
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
|
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
exiting = TRUE;
|
exiting = TRUE;
|
||||||
if (eap->forceit || !check_changed_any(FALSE, FALSE))
|
if (eap->forceit || !check_changed_any(FALSE, FALSE))
|
||||||
@ -7345,11 +7325,7 @@ ex_close(exarg_T *eap)
|
|||||||
cmdwin_result = Ctrl_C;
|
cmdwin_result = Ctrl_C;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!text_locked()
|
if (!text_locked() && !curbuf_locked())
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !curbuf_locked()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (eap->addr_count == 0)
|
if (eap->addr_count == 0)
|
||||||
ex_win_close(eap->forceit, curwin, NULL);
|
ex_win_close(eap->forceit, curwin, NULL);
|
||||||
@ -7565,11 +7541,7 @@ ex_tabclose(exarg_T *eap)
|
|||||||
tabpage_close_other(tp, eap->forceit);
|
tabpage_close_other(tp, eap->forceit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!text_locked()
|
else if (!text_locked() && !curbuf_locked())
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !curbuf_locked()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
tabpage_close(eap->forceit);
|
tabpage_close(eap->forceit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7662,9 +7634,7 @@ tabpage_close_other(tabpage_T *tp, int forceit)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
redraw_tabline = TRUE;
|
redraw_tabline = TRUE;
|
||||||
if (h != tabline_height())
|
if (h != tabline_height())
|
||||||
@ -7790,13 +7760,11 @@ ex_exit(exarg_T *eap)
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
|
||||||
/* Refuse to quit when locked or when the buffer in the last window is
|
/* Refuse to quit when locked or when the buffer in the last window is
|
||||||
* being closed (can only happen in autocommands). */
|
* being closed (can only happen in autocommands). */
|
||||||
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
|
if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0))
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if more files or windows we won't exit
|
* if more files or windows we won't exit
|
||||||
@ -7901,10 +7869,9 @@ handle_drop(
|
|||||||
/* Postpone this while editing the command line. */
|
/* Postpone this while editing the command line. */
|
||||||
if (text_locked())
|
if (text_locked())
|
||||||
return;
|
return;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
/* When the screen is being updated we should not change buffers and
|
/* When the screen is being updated we should not change buffers and
|
||||||
* windows structures, it may cause freed memory to be used. */
|
* windows structures, it may cause freed memory to be used. */
|
||||||
if (updating_screen)
|
if (updating_screen)
|
||||||
@ -8072,9 +8039,7 @@ alist_set(
|
|||||||
|
|
||||||
if (recursive)
|
if (recursive)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EMSG(_(e_au_recursive));
|
EMSG(_(e_au_recursive));
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++recursive;
|
++recursive;
|
||||||
@ -8251,11 +8216,10 @@ ex_splitview(exarg_T *eap)
|
|||||||
&& eap->cmdidx != CMD_vnew
|
&& eap->cmdidx != CMD_vnew
|
||||||
&& eap->cmdidx != CMD_new)
|
&& eap->cmdidx != CMD_new)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (
|
if (
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
!gui.in_use &&
|
!gui.in_use &&
|
||||||
# endif
|
# endif
|
||||||
au_has_group((char_u *)"FileExplorer"))
|
au_has_group((char_u *)"FileExplorer"))
|
||||||
{
|
{
|
||||||
/* No browsing supported but we do have the file explorer:
|
/* No browsing supported but we do have the file explorer:
|
||||||
@ -8264,7 +8228,6 @@ ex_splitview(exarg_T *eap)
|
|||||||
eap->arg = (char_u *)".";
|
eap->arg = (char_u *)".";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
fname = do_browse(0, (char_u *)_("Edit File in new window"),
|
fname = do_browse(0, (char_u *)_("Edit File in new window"),
|
||||||
eap->arg, NULL, NULL, NULL, curbuf);
|
eap->arg, NULL, NULL, NULL, curbuf);
|
||||||
@ -8668,12 +8631,11 @@ do_exedit(
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Can't edit another file when "curbuf_lock" is set. Only ":edit"
|
/* Can't edit another file when "curbuf_lock" is set. Only ":edit"
|
||||||
* can bring us here, others are stopped earlier. */
|
* can bring us here, others are stopped earlier. */
|
||||||
if (*eap->arg != NUL && curbuf_locked())
|
if (*eap->arg != NUL && curbuf_locked())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
n = readonlymode;
|
n = readonlymode;
|
||||||
if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview)
|
if (eap->cmdidx == CMD_view || eap->cmdidx == CMD_sview)
|
||||||
readonlymode = TRUE;
|
readonlymode = TRUE;
|
||||||
@ -8702,7 +8664,7 @@ do_exedit(
|
|||||||
need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1);
|
need_hide = (curbufIsChanged() && curbuf->b_nwindows <= 1);
|
||||||
if (!need_hide || buf_hide(curbuf))
|
if (!need_hide || buf_hide(curbuf))
|
||||||
{
|
{
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
cleanup_T cs;
|
cleanup_T cs;
|
||||||
|
|
||||||
/* Reset the error/interrupt/exception state here so that
|
/* Reset the error/interrupt/exception state here so that
|
||||||
@ -8714,7 +8676,7 @@ do_exedit(
|
|||||||
#endif
|
#endif
|
||||||
win_close(curwin, !need_hide && !buf_hide(curbuf));
|
win_close(curwin, !need_hide && !buf_hide(curbuf));
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not
|
/* Restore the error/interrupt/exception state if not
|
||||||
* discarded by a new aborting error, interrupt, or
|
* discarded by a new aborting error, interrupt, or
|
||||||
* uncaught exception. */
|
* uncaught exception. */
|
||||||
@ -8927,7 +8889,7 @@ ex_read(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (i != OK)
|
if (i != OK)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!aborting())
|
if (!aborting())
|
||||||
#endif
|
#endif
|
||||||
EMSG2(_(e_notopen), eap->arg);
|
EMSG2(_(e_notopen), eap->arg);
|
||||||
@ -9013,10 +8975,8 @@ ex_cd(exarg_T *eap)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (allbuf_locked())
|
if (allbuf_locked())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
|
if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged()
|
||||||
&& !eap->forceit)
|
&& !eap->forceit)
|
||||||
{
|
{
|
||||||
@ -9073,11 +9033,9 @@ ex_cd(exarg_T *eap)
|
|||||||
/* Echo the new current directory if the command was typed. */
|
/* Echo the new current directory if the command was typed. */
|
||||||
if (KeyTyped || p_verbose >= 5)
|
if (KeyTyped || p_verbose >= 5)
|
||||||
ex_pwd(eap);
|
ex_pwd(eap);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_DIRCHANGED,
|
apply_autocmds(EVENT_DIRCHANGED,
|
||||||
is_local_chdir ? (char_u *)"window" : (char_u *)"global",
|
is_local_chdir ? (char_u *)"window" : (char_u *)"global",
|
||||||
new_dir, FALSE, curbuf);
|
new_dir, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
vim_free(tofree);
|
vim_free(tofree);
|
||||||
}
|
}
|
||||||
@ -10588,21 +10546,15 @@ find_cmdline_var(char_u *src, int *usedlen)
|
|||||||
#define SPEC_SFILE (SPEC_CFILE + 1)
|
#define SPEC_SFILE (SPEC_CFILE + 1)
|
||||||
"<slnum>", /* ":so" file line number */
|
"<slnum>", /* ":so" file line number */
|
||||||
#define SPEC_SLNUM (SPEC_SFILE + 1)
|
#define SPEC_SLNUM (SPEC_SFILE + 1)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
"<afile>", /* autocommand file name */
|
"<afile>", /* autocommand file name */
|
||||||
# define SPEC_AFILE (SPEC_SLNUM + 1)
|
#define SPEC_AFILE (SPEC_SLNUM + 1)
|
||||||
"<abuf>", /* autocommand buffer number */
|
"<abuf>", /* autocommand buffer number */
|
||||||
# define SPEC_ABUF (SPEC_AFILE + 1)
|
#define SPEC_ABUF (SPEC_AFILE + 1)
|
||||||
"<amatch>", /* autocommand match name */
|
"<amatch>", /* autocommand match name */
|
||||||
# define SPEC_AMATCH (SPEC_ABUF + 1)
|
#define SPEC_AMATCH (SPEC_ABUF + 1)
|
||||||
#endif
|
|
||||||
#ifdef FEAT_CLIENTSERVER
|
#ifdef FEAT_CLIENTSERVER
|
||||||
"<client>"
|
"<client>"
|
||||||
# ifdef FEAT_AUTOCMD
|
# define SPEC_CLIENT (SPEC_AMATCH + 1)
|
||||||
# define SPEC_CLIENT (SPEC_AMATCH + 1)
|
|
||||||
# else
|
|
||||||
# define SPEC_CLIENT (SPEC_SLNUM + 1)
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -10801,7 +10753,6 @@ eval_vars(
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case SPEC_AFILE: /* file name for autocommand */
|
case SPEC_AFILE: /* file name for autocommand */
|
||||||
result = autocmd_fname;
|
result = autocmd_fname;
|
||||||
if (result != NULL && !autocmd_fname_full)
|
if (result != NULL && !autocmd_fname_full)
|
||||||
@ -10840,7 +10791,6 @@ eval_vars(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#endif
|
|
||||||
case SPEC_SFILE: /* file name for ":so" command */
|
case SPEC_SFILE: /* file name for ":so" command */
|
||||||
result = sourcing_name;
|
result = sourcing_name;
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
@ -10976,7 +10926,6 @@ arg_all(void)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Expand the <sfile> string in "arg".
|
* Expand the <sfile> string in "arg".
|
||||||
*
|
*
|
||||||
@ -11038,7 +10987,6 @@ expand_sfile(char_u *arg)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_SESSION
|
#ifdef FEAT_SESSION
|
||||||
static int ses_winsizes(FILE *fd, int restore_size,
|
static int ses_winsizes(FILE *fd, int restore_size,
|
||||||
@ -12070,7 +12018,6 @@ get_mapclear_arg(expand_T *xp UNUSED, int idx)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static int filetype_detect = FALSE;
|
static int filetype_detect = FALSE;
|
||||||
static int filetype_plugin = FALSE;
|
static int filetype_plugin = FALSE;
|
||||||
static int filetype_indent = FALSE;
|
static int filetype_indent = FALSE;
|
||||||
@ -12184,7 +12131,6 @@ ex_setfiletype(exarg_T *eap)
|
|||||||
did_filetype = FALSE;
|
did_filetype = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ex_digraphs(exarg_T *eap UNUSED)
|
ex_digraphs(exarg_T *eap UNUSED)
|
||||||
@ -12208,7 +12154,7 @@ ex_set(exarg_T *eap)
|
|||||||
flags = OPT_LOCAL;
|
flags = OPT_LOCAL;
|
||||||
else if (eap->cmdidx == CMD_setglobal)
|
else if (eap->cmdidx == CMD_setglobal)
|
||||||
flags = OPT_GLOBAL;
|
flags = OPT_GLOBAL;
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_AUTOCMD) && defined(FEAT_BROWSE)
|
#if defined(FEAT_EVAL) && defined(FEAT_BROWSE)
|
||||||
if (cmdmod.browse && flags == 0)
|
if (cmdmod.browse && flags == 0)
|
||||||
ex_options(eap);
|
ex_options(eap);
|
||||||
else
|
else
|
||||||
|
@ -146,7 +146,6 @@ static void set_search_match(pos_T *t);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void
|
static void
|
||||||
trigger_cmd_autocmd(int typechar, int evt)
|
trigger_cmd_autocmd(int typechar, int evt)
|
||||||
{
|
{
|
||||||
@ -156,7 +155,6 @@ trigger_cmd_autocmd(int typechar, int evt)
|
|||||||
typestr[1] = NUL;
|
typestr[1] = NUL;
|
||||||
apply_autocmds(evt, typestr, typestr, FALSE, curbuf);
|
apply_autocmds(evt, typestr, typestr, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Abandon the command line.
|
* Abandon the command line.
|
||||||
@ -266,9 +264,7 @@ getcmdline(
|
|||||||
* custom status line may invoke ":normal". */
|
* custom status line may invoke ":normal". */
|
||||||
struct cmdline_info save_ccline;
|
struct cmdline_info save_ccline;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int cmdline_type;
|
int cmdline_type;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (firstc == -1)
|
if (firstc == -1)
|
||||||
@ -376,11 +372,11 @@ getcmdline(
|
|||||||
b_im_ptr = &curbuf->b_p_imsearch;
|
b_im_ptr = &curbuf->b_p_imsearch;
|
||||||
if (*b_im_ptr == B_IMODE_LMAP)
|
if (*b_im_ptr == B_IMODE_LMAP)
|
||||||
State |= LANGMAP;
|
State |= LANGMAP;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
im_set_active(*b_im_ptr == B_IMODE_IM);
|
im_set_active(*b_im_ptr == B_IMODE_IM);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
else if (p_imcmdline)
|
else if (p_imcmdline)
|
||||||
im_set_active(TRUE);
|
im_set_active(TRUE);
|
||||||
#endif
|
#endif
|
||||||
@ -396,11 +392,9 @@ getcmdline(
|
|||||||
* terminal mode set to cooked. Need to set raw mode here then. */
|
* terminal mode set to cooked. Need to set raw mode here then. */
|
||||||
settmode(TMODE_RAW);
|
settmode(TMODE_RAW);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger CmdlineEnter autocommands. */
|
/* Trigger CmdlineEnter autocommands. */
|
||||||
cmdline_type = firstc == NUL ? '-' : firstc;
|
cmdline_type = firstc == NUL ? '-' : firstc;
|
||||||
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER);
|
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_CMDHIST
|
#ifdef FEAT_CMDHIST
|
||||||
init_history();
|
init_history();
|
||||||
@ -1132,7 +1126,7 @@ getcmdline(
|
|||||||
{
|
{
|
||||||
/* ":lmap" mappings exists, toggle use of mappings. */
|
/* ":lmap" mappings exists, toggle use of mappings. */
|
||||||
State ^= LANGMAP;
|
State ^= LANGMAP;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
im_set_active(FALSE); /* Disable input method */
|
im_set_active(FALSE); /* Disable input method */
|
||||||
#endif
|
#endif
|
||||||
if (b_im_ptr != NULL)
|
if (b_im_ptr != NULL)
|
||||||
@ -1143,7 +1137,7 @@ getcmdline(
|
|||||||
*b_im_ptr = B_IMODE_NONE;
|
*b_im_ptr = B_IMODE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* There are no ":lmap" mappings, toggle IM. When
|
/* There are no ":lmap" mappings, toggle IM. When
|
||||||
@ -1946,10 +1940,8 @@ cmdline_not_changed:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmdline_changed:
|
cmdline_changed:
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger CmdlineChanged autocommands. */
|
/* Trigger CmdlineChanged autocommands. */
|
||||||
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
|
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
/*
|
/*
|
||||||
@ -2160,13 +2152,11 @@ returncmd:
|
|||||||
if (some_key_typed)
|
if (some_key_typed)
|
||||||
need_wait_return = FALSE;
|
need_wait_return = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger CmdlineLeave autocommands. */
|
/* Trigger CmdlineLeave autocommands. */
|
||||||
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE);
|
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE);
|
||||||
#endif
|
|
||||||
|
|
||||||
State = save_State;
|
State = save_State;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
|
if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP)
|
||||||
im_save_status(b_im_ptr);
|
im_save_status(b_im_ptr);
|
||||||
im_set_active(FALSE);
|
im_set_active(FALSE);
|
||||||
@ -2266,7 +2256,6 @@ get_text_locked_msg(void)
|
|||||||
return e_secure;
|
return e_secure;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
|
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
|
||||||
* and give an error message.
|
* and give an error message.
|
||||||
@ -2296,7 +2285,6 @@ allbuf_locked(void)
|
|||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmdline_charsize(int idx)
|
cmdline_charsize(int idx)
|
||||||
@ -4983,10 +4971,8 @@ ExpandFromContext(
|
|||||||
{EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
|
{EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
|
||||||
#endif
|
#endif
|
||||||
{EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
|
{EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{EXPAND_EVENTS, get_event_name, TRUE, TRUE},
|
{EXPAND_EVENTS, get_event_name, TRUE, TRUE},
|
||||||
{EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE},
|
{EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE},
|
||||||
#endif
|
|
||||||
#ifdef FEAT_CSCOPE
|
#ifdef FEAT_CSCOPE
|
||||||
{EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},
|
{EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},
|
||||||
#endif
|
#endif
|
||||||
@ -6930,10 +6916,9 @@ open_cmdwin(void)
|
|||||||
/* Save current window sizes. */
|
/* Save current window sizes. */
|
||||||
win_size_save(&winsizes);
|
win_size_save(&winsizes);
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute autocommands while creating the window. */
|
/* Don't execute autocommands while creating the window. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
# endif
|
|
||||||
/* don't use a new tab page */
|
/* don't use a new tab page */
|
||||||
cmdmod.tab = 0;
|
cmdmod.tab = 0;
|
||||||
cmdmod.noswapfile = 1;
|
cmdmod.noswapfile = 1;
|
||||||
@ -6942,9 +6927,7 @@ open_cmdwin(void)
|
|||||||
if (win_split((int)p_cwh, WSP_BOT) == FAIL)
|
if (win_split((int)p_cwh, WSP_BOT) == FAIL)
|
||||||
{
|
{
|
||||||
beep_flush();
|
beep_flush();
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
# endif
|
|
||||||
return K_IGNORE;
|
return K_IGNORE;
|
||||||
}
|
}
|
||||||
cmdwin_type = get_cmdline_type();
|
cmdwin_type = get_cmdline_type();
|
||||||
@ -6963,12 +6946,10 @@ open_cmdwin(void)
|
|||||||
# endif
|
# endif
|
||||||
RESET_BINDING(curwin);
|
RESET_BINDING(curwin);
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* Do execute autocommands for setting the filetype (load syntax). */
|
/* Do execute autocommands for setting the filetype (load syntax). */
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
/* But don't allow switching to another buffer. */
|
/* But don't allow switching to another buffer. */
|
||||||
++curbuf_lock;
|
++curbuf_lock;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Showing the prompt may have set need_wait_return, reset it. */
|
/* Showing the prompt may have set need_wait_return, reset it. */
|
||||||
need_wait_return = FALSE;
|
need_wait_return = FALSE;
|
||||||
@ -6983,9 +6964,7 @@ open_cmdwin(void)
|
|||||||
}
|
}
|
||||||
set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
|
set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
|
||||||
}
|
}
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
--curbuf_lock;
|
--curbuf_lock;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
|
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
|
||||||
* sets 'textwidth' to 78). */
|
* sets 'textwidth' to 78). */
|
||||||
@ -7031,12 +7010,10 @@ open_cmdwin(void)
|
|||||||
setmouse();
|
setmouse();
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger CmdwinEnter autocommands. */
|
/* Trigger CmdwinEnter autocommands. */
|
||||||
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
|
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINENTER);
|
||||||
if (restart_edit != 0) /* autocmd with ":startinsert" */
|
if (restart_edit != 0) /* autocmd with ":startinsert" */
|
||||||
stuffcharReadbuff(K_NOP);
|
stuffcharReadbuff(K_NOP);
|
||||||
# endif
|
|
||||||
|
|
||||||
i = RedrawingDisabled;
|
i = RedrawingDisabled;
|
||||||
RedrawingDisabled = 0;
|
RedrawingDisabled = 0;
|
||||||
@ -7049,20 +7026,16 @@ open_cmdwin(void)
|
|||||||
|
|
||||||
RedrawingDisabled = i;
|
RedrawingDisabled = i;
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
# ifdef FEAT_FOLDING
|
||||||
|
|
||||||
# ifdef FEAT_FOLDING
|
|
||||||
save_KeyTyped = KeyTyped;
|
save_KeyTyped = KeyTyped;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Trigger CmdwinLeave autocommands. */
|
/* Trigger CmdwinLeave autocommands. */
|
||||||
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE);
|
trigger_cmd_autocmd(cmdwin_type, EVENT_CMDWINLEAVE);
|
||||||
|
|
||||||
# ifdef FEAT_FOLDING
|
# ifdef FEAT_FOLDING
|
||||||
/* Restore KeyTyped in case it is modified by autocommands */
|
/* Restore KeyTyped in case it is modified by autocommands */
|
||||||
KeyTyped = save_KeyTyped;
|
KeyTyped = save_KeyTyped;
|
||||||
# endif
|
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Restore the command line info. */
|
/* Restore the command line info. */
|
||||||
@ -7080,7 +7053,7 @@ open_cmdwin(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
# if defined(FEAT_EVAL)
|
||||||
/* autocmds may abort script processing */
|
/* autocmds may abort script processing */
|
||||||
if (aborting() && cmdwin_result != K_IGNORE)
|
if (aborting() && cmdwin_result != K_IGNORE)
|
||||||
cmdwin_result = Ctrl_C;
|
cmdwin_result = Ctrl_C;
|
||||||
@ -7141,10 +7114,8 @@ open_cmdwin(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute autocommands while deleting the window. */
|
/* Don't execute autocommands while deleting the window. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
/* Avoid command-line window first character being concealed. */
|
/* Avoid command-line window first character being concealed. */
|
||||||
curwin->w_p_cole = 0;
|
curwin->w_p_cole = 0;
|
||||||
@ -7162,9 +7133,7 @@ open_cmdwin(void)
|
|||||||
/* Restore window sizes. */
|
/* Restore window sizes. */
|
||||||
win_size_restore(&winsizes);
|
win_size_restore(&winsizes);
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ga_clear(&winsizes);
|
ga_clear(&winsizes);
|
||||||
|
@ -439,18 +439,11 @@
|
|||||||
# define FEAT_MODIFY_FNAME
|
# define FEAT_MODIFY_FNAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* +autocmd ":autocmd" command
|
|
||||||
*/
|
|
||||||
#ifdef FEAT_NORMAL
|
|
||||||
# define FEAT_AUTOCMD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +diff Displaying diffs in a nice way.
|
* +diff Displaying diffs in a nice way.
|
||||||
* Requires +windows and +autocmd.
|
* Requires +windows and +autocmd.
|
||||||
*/
|
*/
|
||||||
#if defined(FEAT_NORMAL) && defined(FEAT_AUTOCMD)
|
#if defined(FEAT_NORMAL)
|
||||||
# define FEAT_DIFF
|
# define FEAT_DIFF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
143
src/fileio.c
143
src/fileio.c
@ -47,14 +47,12 @@ static int msg_add_fileformat(int eol_type);
|
|||||||
static void msg_add_eol(void);
|
static void msg_add_eol(void);
|
||||||
static int check_mtime(buf_T *buf, stat_T *s);
|
static int check_mtime(buf_T *buf, stat_T *s);
|
||||||
static int time_differs(long t1, long t2);
|
static int time_differs(long t1, long t2);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap);
|
static int apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap);
|
||||||
static int au_find_group(char_u *name);
|
static int au_find_group(char_u *name);
|
||||||
|
|
||||||
# define AUGROUP_DEFAULT -1 /* default autocmd group */
|
# define AUGROUP_DEFAULT -1 /* default autocmd group */
|
||||||
# define AUGROUP_ERROR -2 /* erroneous autocmd group */
|
# define AUGROUP_ERROR -2 /* erroneous autocmd group */
|
||||||
# define AUGROUP_ALL -3 /* all autocmd groups */
|
# define AUGROUP_ALL -3 /* all autocmd groups */
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_CRYPT) || defined(FEAT_MBYTE)
|
#if defined(FEAT_CRYPT) || defined(FEAT_MBYTE)
|
||||||
# define HAS_BW_FLAGS
|
# define HAS_BW_FLAGS
|
||||||
@ -135,11 +133,8 @@ static int move_lines(buf_T *frombuf, buf_T *tobuf);
|
|||||||
#ifdef TEMPDIRNAMES
|
#ifdef TEMPDIRNAMES
|
||||||
static void vim_settempdir(char_u *tempdir);
|
static void vim_settempdir(char_u *tempdir);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
|
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Set by the apply_autocmds_group function if the given event is equal to
|
* Set by the apply_autocmds_group function if the given event is equal to
|
||||||
* EVENT_FILETYPE. Used by the readfile function in order to determine if
|
* EVENT_FILETYPE. Used by the readfile function in order to determine if
|
||||||
@ -149,7 +144,6 @@ static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer na
|
|||||||
* apply_autocmds_group.
|
* apply_autocmds_group.
|
||||||
*/
|
*/
|
||||||
static int au_did_filetype INIT(= FALSE);
|
static int au_did_filetype INIT(= FALSE);
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
filemess(
|
filemess(
|
||||||
@ -307,17 +301,13 @@ readfile(
|
|||||||
char_u conv_rest[CONV_RESTLEN];
|
char_u conv_rest[CONV_RESTLEN];
|
||||||
int conv_restlen = 0; /* nr of bytes in conv_rest[] */
|
int conv_restlen = 0; /* nr of bytes in conv_rest[] */
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *old_curbuf;
|
buf_T *old_curbuf;
|
||||||
char_u *old_b_ffname;
|
char_u *old_b_ffname;
|
||||||
char_u *old_b_fname;
|
char_u *old_b_fname;
|
||||||
int using_b_ffname;
|
int using_b_ffname;
|
||||||
int using_b_fname;
|
int using_b_fname;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
au_did_filetype = FALSE; /* reset before triggering any autocommands */
|
au_did_filetype = FALSE; /* reset before triggering any autocommands */
|
||||||
#endif
|
|
||||||
|
|
||||||
curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */
|
curbuf->b_no_eol_lnum = 0; /* in case it was set by the previous read */
|
||||||
|
|
||||||
@ -337,7 +327,6 @@ readfile(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Remember the initial values of curbuf, curbuf->b_ffname and
|
/* Remember the initial values of curbuf, curbuf->b_ffname and
|
||||||
* curbuf->b_fname to detect whether they are altered as a result of
|
* curbuf->b_fname to detect whether they are altered as a result of
|
||||||
* executing nasty autocommands. Also check if "fname" and "sfname"
|
* executing nasty autocommands. Also check if "fname" and "sfname"
|
||||||
@ -348,7 +337,6 @@ readfile(
|
|||||||
using_b_ffname = (fname == curbuf->b_ffname)
|
using_b_ffname = (fname == curbuf->b_ffname)
|
||||||
|| (sfname == curbuf->b_ffname);
|
|| (sfname == curbuf->b_ffname);
|
||||||
using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
|
using_b_fname = (fname == curbuf->b_fname) || (sfname == curbuf->b_fname);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* After reading a file the cursor line changes but we don't want to
|
/* After reading a file the cursor line changes but we don't want to
|
||||||
* display the line. */
|
* display the line. */
|
||||||
@ -369,7 +357,6 @@ readfile(
|
|||||||
fname = sfname;
|
fname = sfname;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* The BufReadCmd and FileReadCmd events intercept the reading process by
|
* The BufReadCmd and FileReadCmd events intercept the reading process by
|
||||||
* executing the associated commands instead.
|
* executing the associated commands instead.
|
||||||
@ -404,7 +391,6 @@ readfile(
|
|||||||
|
|
||||||
curbuf->b_op_start = pos;
|
curbuf->b_op_start = pos;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
|
if ((shortmess(SHM_OVER) || curbuf->b_help) && p_verbose == 0)
|
||||||
msg_scroll = FALSE; /* overwrite previous file message */
|
msg_scroll = FALSE; /* overwrite previous file message */
|
||||||
@ -613,7 +599,6 @@ readfile(
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
check_need_swap(newfile);
|
check_need_swap(newfile);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* SwapExists autocommand may mess things up */
|
/* SwapExists autocommand may mess things up */
|
||||||
if (curbuf != old_curbuf
|
if (curbuf != old_curbuf
|
||||||
|| (using_b_ffname
|
|| (using_b_ffname
|
||||||
@ -624,7 +609,6 @@ readfile(
|
|||||||
EMSG(_(e_auchangedbuf));
|
EMSG(_(e_auchangedbuf));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if (dir_of_file_exists(fname))
|
if (dir_of_file_exists(fname))
|
||||||
filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
|
filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
|
||||||
@ -641,14 +625,12 @@ readfile(
|
|||||||
if (eap != NULL)
|
if (eap != NULL)
|
||||||
set_forced_fenc(eap);
|
set_forced_fenc(eap);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname,
|
apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname,
|
||||||
FALSE, curbuf, eap);
|
FALSE, curbuf, eap);
|
||||||
#endif
|
|
||||||
/* remember the current fileformat */
|
/* remember the current fileformat */
|
||||||
save_file_ff(curbuf);
|
save_file_ff(curbuf);
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#endif
|
#endif
|
||||||
@ -701,7 +683,6 @@ readfile(
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
check_need_swap(newfile);
|
check_need_swap(newfile);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!read_stdin && (curbuf != old_curbuf
|
if (!read_stdin && (curbuf != old_curbuf
|
||||||
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|
||||||
|| (using_b_fname && (old_b_fname != curbuf->b_fname))))
|
|| (using_b_fname && (old_b_fname != curbuf->b_fname))))
|
||||||
@ -711,7 +692,6 @@ readfile(
|
|||||||
close(fd);
|
close(fd);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
/* Set swap file protection bits after creating it. */
|
/* Set swap file protection bits after creating it. */
|
||||||
if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
|
if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
|
||||||
@ -764,7 +744,6 @@ readfile(
|
|||||||
try_dos = (vim_strchr(p_ffs, 'd') != NULL);
|
try_dos = (vim_strchr(p_ffs, 'd') != NULL);
|
||||||
try_unix = (vim_strchr(p_ffs, 'x') != NULL);
|
try_unix = (vim_strchr(p_ffs, 'x') != NULL);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!read_buffer)
|
if (!read_buffer)
|
||||||
{
|
{
|
||||||
int m = msg_scroll;
|
int m = msg_scroll;
|
||||||
@ -834,7 +813,6 @@ readfile(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* FEAT_AUTOCMD */
|
|
||||||
|
|
||||||
/* Autocommands may add lines to the file, need to check if it is empty */
|
/* Autocommands may add lines to the file, need to check if it is empty */
|
||||||
wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY);
|
wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY);
|
||||||
@ -2704,7 +2682,6 @@ failed:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL))
|
if (!read_stdin && !read_fifo && (!read_buffer || sfname != NULL))
|
||||||
{
|
{
|
||||||
int m = msg_scroll;
|
int m = msg_scroll;
|
||||||
@ -2746,7 +2723,6 @@ failed:
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (recoverymode && error)
|
if (recoverymode && error)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -3197,9 +3173,7 @@ buf_write(
|
|||||||
#endif
|
#endif
|
||||||
/* writing everything */
|
/* writing everything */
|
||||||
int whole = (start == 1 && end == buf->b_ml.ml_line_count);
|
int whole = (start == 1 && end == buf->b_ml.ml_line_count);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
linenr_T old_line_count = buf->b_ml.ml_line_count;
|
linenr_T old_line_count = buf->b_ml.ml_line_count;
|
||||||
#endif
|
|
||||||
int attr;
|
int attr;
|
||||||
int fileformat;
|
int fileformat;
|
||||||
int write_bin;
|
int write_bin;
|
||||||
@ -3319,7 +3293,6 @@ buf_write(
|
|||||||
buf->b_op_end.lnum = end;
|
buf->b_op_end.lnum = end;
|
||||||
buf->b_op_end.col = 0;
|
buf->b_op_end.col = 0;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{
|
{
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
int buf_ffname = FALSE;
|
int buf_ffname = FALSE;
|
||||||
@ -3509,7 +3482,6 @@ buf_write(
|
|||||||
if (buf_fname_s)
|
if (buf_fname_s)
|
||||||
fname = buf->b_sfname;
|
fname = buf->b_sfname;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
if (netbeans_active() && isNetbeansBuffer(buf))
|
if (netbeans_active() && isNetbeansBuffer(buf))
|
||||||
@ -5020,12 +4992,10 @@ restore_backup:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
unchanged(buf, TRUE);
|
unchanged(buf, TRUE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* b:changedtick is always incremented in unchanged() but that
|
/* b:changedtick is always incremented in unchanged() but that
|
||||||
* should not trigger a TextChanged event. */
|
* should not trigger a TextChanged event. */
|
||||||
if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf))
|
if (buf->b_last_changedtick + 1 == CHANGEDTICK(buf))
|
||||||
buf->b_last_changedtick = CHANGEDTICK(buf);
|
buf->b_last_changedtick = CHANGEDTICK(buf);
|
||||||
#endif
|
|
||||||
u_unchanged(buf);
|
u_unchanged(buf);
|
||||||
u_update_save_nr(buf);
|
u_update_save_nr(buf);
|
||||||
}
|
}
|
||||||
@ -5194,7 +5164,6 @@ nofail:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (!should_abort(retval))
|
if (!should_abort(retval))
|
||||||
#else
|
#else
|
||||||
@ -5232,7 +5201,6 @@ nofail:
|
|||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
got_int |= prev_got_int;
|
got_int |= prev_got_int;
|
||||||
|
|
||||||
@ -5246,37 +5214,34 @@ nofail:
|
|||||||
static int
|
static int
|
||||||
set_rw_fname(char_u *fname, char_u *sfname)
|
set_rw_fname(char_u *fname, char_u *sfname)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *buf = curbuf;
|
buf_T *buf = curbuf;
|
||||||
|
|
||||||
/* It's like the unnamed buffer is deleted.... */
|
/* It's like the unnamed buffer is deleted.... */
|
||||||
if (curbuf->b_p_bl)
|
if (curbuf->b_p_bl)
|
||||||
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWIPEOUT, NULL, NULL, FALSE, curbuf);
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
#endif
|
||||||
if (curbuf != buf)
|
if (curbuf != buf)
|
||||||
{
|
{
|
||||||
/* We are in another buffer now, don't do the renaming. */
|
/* We are in another buffer now, don't do the renaming. */
|
||||||
EMSG(_(e_auchangedbuf));
|
EMSG(_(e_auchangedbuf));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (setfname(curbuf, fname, sfname, FALSE) == OK)
|
if (setfname(curbuf, fname, sfname, FALSE) == OK)
|
||||||
curbuf->b_flags |= BF_NOTEDITED;
|
curbuf->b_flags |= BF_NOTEDITED;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* ....and a new named one is created */
|
/* ....and a new named one is created */
|
||||||
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, curbuf);
|
||||||
if (curbuf->b_p_bl)
|
if (curbuf->b_p_bl)
|
||||||
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf);
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/* Do filetype detection now if 'filetype' is empty. */
|
/* Do filetype detection now if 'filetype' is empty. */
|
||||||
if (*curbuf->b_p_ft == NUL)
|
if (*curbuf->b_p_ft == NUL)
|
||||||
@ -5285,7 +5250,6 @@ set_rw_fname(char_u *fname, char_u *sfname)
|
|||||||
(void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL);
|
(void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL);
|
||||||
do_modelines(0);
|
do_modelines(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -6105,8 +6069,6 @@ make_bom(char_u *buf, char_u *name)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_VIMINFO) || defined(FEAT_BROWSE) || \
|
|
||||||
defined(FEAT_QUICKFIX) || defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Try to find a shortname by comparing the fullname with the current
|
* Try to find a shortname by comparing the fullname with the current
|
||||||
* directory.
|
* directory.
|
||||||
@ -6130,7 +6092,6 @@ shorten_fname1(char_u *full_path)
|
|||||||
vim_free(dirname);
|
vim_free(dirname);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to find a shortname by comparing the fullname with the current
|
* Try to find a shortname by comparing the fullname with the current
|
||||||
@ -6781,10 +6742,7 @@ check_timestamps(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!stuff_empty() || global_busy || !typebuf_typed()
|
if (!stuff_empty() || global_busy || !typebuf_typed()
|
||||||
#ifdef FEAT_AUTOCMD
|
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0)
|
||||||
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
need_check_timestamps = TRUE; /* check later */
|
need_check_timestamps = TRUE; /* check later */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6898,14 +6856,14 @@ buf_check_timestamp(
|
|||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
int save_mouse_correct = need_mouse_correct;
|
int save_mouse_correct = need_mouse_correct;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static int busy = FALSE;
|
static int busy = FALSE;
|
||||||
int n;
|
int n;
|
||||||
|
#ifdef FEAT_EVAL
|
||||||
char_u *s;
|
char_u *s;
|
||||||
|
#endif
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf);
|
set_bufref(&bufref, buf);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If there is no file name, the buffer is not loaded, 'buftype' is
|
/* If there is no file name, the buffer is not loaded, 'buftype' is
|
||||||
* set, we are in the middle of a save or being called recursively: ignore
|
* set, we are in the middle of a save or being called recursively: ignore
|
||||||
@ -6914,9 +6872,7 @@ buf_check_timestamp(
|
|||||||
|| buf->b_ml.ml_mfp == NULL
|
|| buf->b_ml.ml_mfp == NULL
|
||||||
|| *buf->b_p_bt != NUL
|
|| *buf->b_p_bt != NUL
|
||||||
|| buf->b_saving
|
|| buf->b_saving
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
|| busy
|
|| busy
|
||||||
#endif
|
|
||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
|| isNetbeansBuffer(buf)
|
|| isNetbeansBuffer(buf)
|
||||||
#endif
|
#endif
|
||||||
@ -6977,17 +6933,16 @@ buf_check_timestamp(
|
|||||||
else
|
else
|
||||||
reason = "time";
|
reason = "time";
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Only give the warning if there are no FileChangedShell
|
* Only give the warning if there are no FileChangedShell
|
||||||
* autocommands.
|
* autocommands.
|
||||||
* Avoid being called recursively by setting "busy".
|
* Avoid being called recursively by setting "busy".
|
||||||
*/
|
*/
|
||||||
busy = TRUE;
|
busy = TRUE;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1);
|
set_vim_var_string(VV_FCS_REASON, (char_u *)reason, -1);
|
||||||
set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1);
|
set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", -1);
|
||||||
# endif
|
#endif
|
||||||
++allbuf_lock;
|
++allbuf_lock;
|
||||||
n = apply_autocmds(EVENT_FILECHANGEDSHELL,
|
n = apply_autocmds(EVENT_FILECHANGEDSHELL,
|
||||||
buf->b_fname, buf->b_fname, FALSE, buf);
|
buf->b_fname, buf->b_fname, FALSE, buf);
|
||||||
@ -6997,18 +6952,17 @@ buf_check_timestamp(
|
|||||||
{
|
{
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
EMSG(_("E246: FileChangedShell autocommand deleted buffer"));
|
EMSG(_("E246: FileChangedShell autocommand deleted buffer"));
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
s = get_vim_var_str(VV_FCS_CHOICE);
|
s = get_vim_var_str(VV_FCS_CHOICE);
|
||||||
if (STRCMP(s, "reload") == 0 && *reason != 'd')
|
if (STRCMP(s, "reload") == 0 && *reason != 'd')
|
||||||
reload = TRUE;
|
reload = TRUE;
|
||||||
else if (STRCMP(s, "ask") == 0)
|
else if (STRCMP(s, "ask") == 0)
|
||||||
n = FALSE;
|
n = FALSE;
|
||||||
else
|
else
|
||||||
# endif
|
#endif
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (!n)
|
if (!n)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if (*reason == 'd')
|
if (*reason == 'd')
|
||||||
mesg = _("E211: File \"%s\" no longer available");
|
mesg = _("E211: File \"%s\" no longer available");
|
||||||
@ -7100,9 +7054,7 @@ buf_check_timestamp(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!autocmd_busy)
|
if (!autocmd_busy)
|
||||||
# endif
|
|
||||||
{
|
{
|
||||||
msg_start();
|
msg_start();
|
||||||
msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST);
|
msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST);
|
||||||
@ -7114,9 +7066,9 @@ buf_check_timestamp(
|
|||||||
if (emsg_silent == 0)
|
if (emsg_silent == 0)
|
||||||
{
|
{
|
||||||
out_flush();
|
out_flush();
|
||||||
# ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
if (!focus)
|
if (!focus)
|
||||||
# endif
|
#endif
|
||||||
/* give the user some time to think about it */
|
/* give the user some time to think about it */
|
||||||
ui_delay(1000L, TRUE);
|
ui_delay(1000L, TRUE);
|
||||||
|
|
||||||
@ -7151,12 +7103,10 @@ buf_check_timestamp(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger FileChangedShell when the file was changed in any way. */
|
/* Trigger FileChangedShell when the file was changed in any way. */
|
||||||
if (bufref_valid(&bufref) && retval != 0)
|
if (bufref_valid(&bufref) && retval != 0)
|
||||||
(void)apply_autocmds(EVENT_FILECHANGEDSHELLPOST,
|
(void)apply_autocmds(EVENT_FILECHANGEDSHELLPOST,
|
||||||
buf->b_fname, buf->b_fname, FALSE, buf);
|
buf->b_fname, buf->b_fname, FALSE, buf);
|
||||||
#endif
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
/* restore this in case an autocommand has set it; it would break
|
/* restore this in case an autocommand has set it; it would break
|
||||||
* 'mousefocus' */
|
* 'mousefocus' */
|
||||||
@ -7240,14 +7190,12 @@ buf_reload(buf_T *buf, int orig_mode)
|
|||||||
if (saved == OK)
|
if (saved == OK)
|
||||||
{
|
{
|
||||||
curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */
|
curbuf->b_flags |= BF_CHECK_RO; /* check for RO again */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
keep_filetype = TRUE; /* don't detect 'filetype' */
|
keep_filetype = TRUE; /* don't detect 'filetype' */
|
||||||
#endif
|
|
||||||
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0,
|
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0,
|
||||||
(linenr_T)0,
|
(linenr_T)0,
|
||||||
(linenr_T)MAXLNUM, &ea, flags) != OK)
|
(linenr_T)MAXLNUM, &ea, flags) != OK)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!aborting())
|
if (!aborting())
|
||||||
#endif
|
#endif
|
||||||
EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname);
|
EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname);
|
||||||
@ -7296,9 +7244,7 @@ buf_reload(buf_T *buf, int orig_mode)
|
|||||||
curwin->w_cursor = old_cursor;
|
curwin->w_cursor = old_cursor;
|
||||||
check_cursor();
|
check_cursor();
|
||||||
update_topline();
|
update_topline();
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
keep_filetype = FALSE;
|
keep_filetype = FALSE;
|
||||||
#endif
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
{
|
{
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
@ -7672,12 +7618,8 @@ forward_slash(char_u *fname)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Code for automatic commands.
|
* Code for automatic commands.
|
||||||
*
|
|
||||||
* Only included when "FEAT_AUTOCMD" has been defined.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The autocommands are stored in a list for each event.
|
* The autocommands are stored in a list for each event.
|
||||||
* Autocommands for the same pattern, that are consecutive, are joined
|
* Autocommands for the same pattern, that are consecutive, are joined
|
||||||
@ -7914,9 +7856,7 @@ static int au_get_grouparg(char_u **argp);
|
|||||||
static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group);
|
static int do_autocmd_event(event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group);
|
||||||
static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap);
|
static int apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap);
|
||||||
static void auto_next_pat(AutoPatCmd *apc, int stop_at_last);
|
static void auto_next_pat(AutoPatCmd *apc, int stop_at_last);
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN)
|
|
||||||
static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs);
|
static int match_file_pat(char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static event_T last_event;
|
static event_T last_event;
|
||||||
@ -9014,7 +8954,6 @@ check_nomodeline(char_u **argp)
|
|||||||
* Search for a visible window containing the current buffer. If there isn't
|
* Search for a visible window containing the current buffer. If there isn't
|
||||||
* one then use "aucmd_win".
|
* one then use "aucmd_win".
|
||||||
* Set "curbuf" and "curwin" to match "buf".
|
* Set "curbuf" and "curwin" to match "buf".
|
||||||
* When FEAT_AUTOCMD is not defined another version is used, see below.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
aucmd_prepbuf(
|
aucmd_prepbuf(
|
||||||
@ -9067,7 +9006,9 @@ aucmd_prepbuf(
|
|||||||
aco->use_aucmd_win = TRUE;
|
aco->use_aucmd_win = TRUE;
|
||||||
aucmd_win_used = TRUE;
|
aucmd_win_used = TRUE;
|
||||||
aucmd_win->w_buffer = buf;
|
aucmd_win->w_buffer = buf;
|
||||||
|
#if defined(FEAT_SYN_HL) || defined(FEAT_SPELL)
|
||||||
aucmd_win->w_s = &buf->b_s;
|
aucmd_win->w_s = &buf->b_s;
|
||||||
|
#endif
|
||||||
++buf->b_nwindows;
|
++buf->b_nwindows;
|
||||||
win_init_empty(aucmd_win); /* set cursor and topline to safe values */
|
win_init_empty(aucmd_win); /* set cursor and topline to safe values */
|
||||||
|
|
||||||
@ -9108,7 +9049,6 @@ aucmd_prepbuf(
|
|||||||
/*
|
/*
|
||||||
* Cleanup after executing autocommands for a (hidden) buffer.
|
* Cleanup after executing autocommands for a (hidden) buffer.
|
||||||
* Restore the window as it was (if possible).
|
* Restore the window as it was (if possible).
|
||||||
* When FEAT_AUTOCMD is not defined another version is used, see below.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
aucmd_restbuf(
|
aucmd_restbuf(
|
||||||
@ -9406,13 +9346,13 @@ has_textyankpost(void)
|
|||||||
static int
|
static int
|
||||||
apply_autocmds_group(
|
apply_autocmds_group(
|
||||||
event_T event,
|
event_T event,
|
||||||
char_u *fname, /* NULL or empty means use actual file name */
|
char_u *fname, /* NULL or empty means use actual file name */
|
||||||
char_u *fname_io, /* fname to use for <afile> on cmdline, NULL means
|
char_u *fname_io, /* fname to use for <afile> on cmdline, NULL means
|
||||||
use fname */
|
use fname */
|
||||||
int force, /* when TRUE, ignore autocmd_busy */
|
int force, /* when TRUE, ignore autocmd_busy */
|
||||||
int group, /* group ID, or AUGROUP_ALL */
|
int group, /* group ID, or AUGROUP_ALL */
|
||||||
buf_T *buf, /* buffer for <abuf> */
|
buf_T *buf, /* buffer for <abuf> */
|
||||||
exarg_T *eap) /* command arguments */
|
exarg_T *eap UNUSED) /* command arguments */
|
||||||
{
|
{
|
||||||
char_u *sfname = NULL; /* short file name */
|
char_u *sfname = NULL; /* short file name */
|
||||||
char_u *tail;
|
char_u *tail;
|
||||||
@ -10210,43 +10150,7 @@ theend:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* FEAT_AUTOCMD */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Prepare for executing commands for (hidden) buffer "buf".
|
|
||||||
* This is the non-autocommand version, it simply saves "curbuf" and sets
|
|
||||||
* "curbuf" and "curwin" to match "buf".
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
aucmd_prepbuf(
|
|
||||||
aco_save_T *aco, /* structure to save values in */
|
|
||||||
buf_T *buf) /* new curbuf */
|
|
||||||
{
|
|
||||||
aco->save_curbuf = curbuf;
|
|
||||||
--curbuf->b_nwindows;
|
|
||||||
curbuf = buf;
|
|
||||||
curwin->w_buffer = buf;
|
|
||||||
++curbuf->b_nwindows;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Restore after executing commands for a (hidden) buffer.
|
|
||||||
* This is the non-autocommand version.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
aucmd_restbuf(
|
|
||||||
aco_save_T *aco) /* structure holding saved values */
|
|
||||||
{
|
|
||||||
--curbuf->b_nwindows;
|
|
||||||
curbuf = aco->save_curbuf;
|
|
||||||
curwin->w_buffer = curbuf;
|
|
||||||
++curbuf->b_nwindows;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* FEAT_AUTOCMD */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Try matching a filename with a "pattern" ("prog" is NULL), or use the
|
* Try matching a filename with a "pattern" ("prog" is NULL), or use the
|
||||||
* precompiled regprog "prog" ("pattern" is NULL). That avoids calling
|
* precompiled regprog "prog" ("pattern" is NULL). That avoids calling
|
||||||
@ -10292,7 +10196,6 @@ match_file_pat(
|
|||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_WILDIGN) || defined(PROTO)
|
#if defined(FEAT_WILDIGN) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
|
@ -516,7 +516,6 @@ CancelRedo(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
|
* Save redobuff and old_redobuff to save_redobuff and save_old_redobuff.
|
||||||
* Used before executing autocommands and user functions.
|
* Used before executing autocommands and user functions.
|
||||||
@ -552,7 +551,6 @@ restoreRedobuff(save_redo_T *save_redo)
|
|||||||
free_buff(&old_redobuff);
|
free_buff(&old_redobuff);
|
||||||
old_redobuff = save_redo->sr_old_redobuff;
|
old_redobuff = save_redo->sr_old_redobuff;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Append "s" to the redo buffer.
|
* Append "s" to the redo buffer.
|
||||||
@ -2891,7 +2889,7 @@ vgetorpeek(int advance)
|
|||||||
+ typebuf.tb_len] != NUL)
|
+ typebuf.tb_len] != NUL)
|
||||||
typebuf.tb_noremap[typebuf.tb_off
|
typebuf.tb_noremap[typebuf.tb_off
|
||||||
+ typebuf.tb_len++] = RM_YES;
|
+ typebuf.tb_len++] = RM_YES;
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
/* Get IM status right after getting keys, not after the
|
/* Get IM status right after getting keys, not after the
|
||||||
* timeout for a mapping (focus may be lost by then). */
|
* timeout for a mapping (focus may be lost by then). */
|
||||||
vgetc_im_active = im_get_status();
|
vgetc_im_active = im_get_status();
|
||||||
@ -3122,10 +3120,8 @@ fix_input_buffer(char_u *buf, int len)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (p[0] == NUL || (p[0] == K_SPECIAL
|
if (p[0] == NUL || (p[0] == K_SPECIAL
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* timeout may generate K_CURSORHOLD */
|
/* timeout may generate K_CURSORHOLD */
|
||||||
&& (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD)
|
&& (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD)
|
||||||
#endif
|
|
||||||
#if defined(WIN3264) && !defined(FEAT_GUI)
|
#if defined(WIN3264) && !defined(FEAT_GUI)
|
||||||
/* Win32 console passes modifiers */
|
/* Win32 console passes modifiers */
|
||||||
&& (i < 2 || p[1] != KS_MODIFIER)
|
&& (i < 2 || p[1] != KS_MODIFIER)
|
||||||
|
@ -385,7 +385,6 @@ EXTERN guicolor_T cterm_normal_bg_gui_color INIT(= INVALCOLOR);
|
|||||||
EXTERN int is_mac_terminal INIT(= FALSE); /* recognized Terminal.app */
|
EXTERN int is_mac_terminal INIT(= FALSE); /* recognized Terminal.app */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
|
EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
|
||||||
EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */
|
EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */
|
||||||
EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */
|
EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */
|
||||||
@ -405,7 +404,6 @@ EXTERN bufref_T au_new_curbuf INIT(= {NULL COMMA 0 COMMA 0});
|
|||||||
* Free the buffer/window when autocmd_busy is being set to FALSE. */
|
* Free the buffer/window when autocmd_busy is being set to FALSE. */
|
||||||
EXTERN buf_T *au_pending_free_buf INIT(= NULL);
|
EXTERN buf_T *au_pending_free_buf INIT(= NULL);
|
||||||
EXTERN win_T *au_pending_free_win INIT(= NULL);
|
EXTERN win_T *au_pending_free_win INIT(= NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MOUSE
|
#ifdef FEAT_MOUSE
|
||||||
/*
|
/*
|
||||||
@ -572,10 +570,8 @@ EXTERN win_T *prevwin INIT(= NULL); /* previous window */
|
|||||||
|
|
||||||
EXTERN win_T *curwin; /* currently active window */
|
EXTERN win_T *curwin; /* currently active window */
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
|
EXTERN win_T *aucmd_win; /* window used in aucmd_prepbuf() */
|
||||||
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
|
EXTERN int aucmd_win_used INIT(= FALSE); /* aucmd_win is being used */
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The window layout is kept in a tree of frames. topframe points to the top
|
* The window layout is kept in a tree of frames. topframe points to the top
|
||||||
@ -639,6 +635,7 @@ EXTERN int exiting INIT(= FALSE);
|
|||||||
EXTERN int really_exiting INIT(= FALSE);
|
EXTERN int really_exiting INIT(= FALSE);
|
||||||
/* TRUE when we are sure to exit, e.g., after
|
/* TRUE when we are sure to exit, e.g., after
|
||||||
* a deadly signal */
|
* a deadly signal */
|
||||||
|
EXTERN int v_dying INIT(= 0); /* internal value of v:dying */
|
||||||
EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */
|
EXTERN int stdout_isatty INIT(= TRUE); /* is stdout a terminal? */
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCHDIR)
|
#if defined(FEAT_AUTOCHDIR)
|
||||||
@ -664,7 +661,6 @@ EXTERN int textlock INIT(= 0);
|
|||||||
/* non-zero when changing text and jumping to
|
/* non-zero when changing text and jumping to
|
||||||
* another window or buffer is not allowed */
|
* another window or buffer is not allowed */
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN int curbuf_lock INIT(= 0);
|
EXTERN int curbuf_lock INIT(= 0);
|
||||||
/* non-zero when the current buffer can't be
|
/* non-zero when the current buffer can't be
|
||||||
* changed. Used for FileChangedRO. */
|
* changed. Used for FileChangedRO. */
|
||||||
@ -673,7 +669,6 @@ EXTERN int allbuf_lock INIT(= 0);
|
|||||||
* changed, no buffer can be deleted and
|
* changed, no buffer can be deleted and
|
||||||
* current directory can't be changed.
|
* current directory can't be changed.
|
||||||
* Used for SwapExists et al. */
|
* Used for SwapExists et al. */
|
||||||
#endif
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
# define HAVE_SANDBOX
|
# define HAVE_SANDBOX
|
||||||
EXTERN int sandbox INIT(= 0);
|
EXTERN int sandbox INIT(= 0);
|
||||||
@ -986,15 +981,12 @@ EXTERN int emsg_silent INIT(= 0); /* don't print error messages */
|
|||||||
EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */
|
EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */
|
||||||
EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
|
EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
|
||||||
|
|
||||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \
|
|
||||||
|| defined(FEAT_AUTOCMD)
|
|
||||||
# define HAS_SWAP_EXISTS_ACTION
|
# define HAS_SWAP_EXISTS_ACTION
|
||||||
EXTERN int swap_exists_action INIT(= SEA_NONE);
|
EXTERN int swap_exists_action INIT(= SEA_NONE);
|
||||||
/* For dialog when swap file already
|
/* For dialog when swap file already
|
||||||
* exists. */
|
* exists. */
|
||||||
EXTERN int swap_exists_did_quit INIT(= FALSE);
|
EXTERN int swap_exists_did_quit INIT(= FALSE);
|
||||||
/* Selected "quit" at the dialog. */
|
/* Selected "quit" at the dialog. */
|
||||||
#endif
|
|
||||||
|
|
||||||
EXTERN char_u *IObuff; /* sprintf's are done in this buffer,
|
EXTERN char_u *IObuff; /* sprintf's are done in this buffer,
|
||||||
size is IOSIZE */
|
size is IOSIZE */
|
||||||
@ -1022,7 +1014,7 @@ EXTERN int stop_insert_mode; /* for ":stopinsert" and 'insertmode' */
|
|||||||
|
|
||||||
EXTERN int KeyTyped; /* TRUE if user typed current char */
|
EXTERN int KeyTyped; /* TRUE if user typed current char */
|
||||||
EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
|
EXTERN int KeyStuffed; /* TRUE if current char from stuffbuf */
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
EXTERN int vgetc_im_active; /* Input Method was active for last
|
EXTERN int vgetc_im_active; /* Input Method was active for last
|
||||||
character obtained from vgetc() */
|
character obtained from vgetc() */
|
||||||
#endif
|
#endif
|
||||||
@ -1075,7 +1067,6 @@ EXTERN char_u *repeat_cmdline INIT(= NULL); /* command line for "." */
|
|||||||
#ifdef FEAT_CMDHIST
|
#ifdef FEAT_CMDHIST
|
||||||
EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
|
EXTERN char_u *new_last_cmdline INIT(= NULL); /* new value for last_cmdline */
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
|
EXTERN char_u *autocmd_fname INIT(= NULL); /* fname for <afile> on cmdline */
|
||||||
EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
|
EXTERN int autocmd_fname_full; /* autocmd_fname is full path */
|
||||||
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
|
EXTERN int autocmd_bufnr INIT(= 0); /* fnum for <abuf> on cmdline */
|
||||||
@ -1086,7 +1077,6 @@ EXTERN pos_T last_cursormoved /* for CursorMoved event */
|
|||||||
= INIT_POS_T(0, 0, 0)
|
= INIT_POS_T(0, 0, 0)
|
||||||
# endif
|
# endif
|
||||||
;
|
;
|
||||||
#endif
|
|
||||||
|
|
||||||
EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */
|
EXTERN int postponed_split INIT(= 0); /* for CTRL-W CTRL-] command */
|
||||||
EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */
|
EXTERN int postponed_split_flags INIT(= 0); /* args for win_split() */
|
||||||
@ -1595,9 +1585,7 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
|
|||||||
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
||||||
#endif
|
#endif
|
||||||
EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
|
EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
|
EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_GUI_MAC
|
#ifdef FEAT_GUI_MAC
|
||||||
EXTERN short disallow_gui INIT(= FALSE);
|
EXTERN short disallow_gui INIT(= FALSE);
|
||||||
|
35
src/gui.c
35
src/gui.c
@ -132,13 +132,11 @@ gui_start(void)
|
|||||||
|
|
||||||
vim_free(old_term);
|
vim_free(old_term);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* If the GUI started successfully, trigger the GUIEnter event, otherwise
|
/* If the GUI started successfully, trigger the GUIEnter event, otherwise
|
||||||
* the GUIFailed event. */
|
* the GUIFailed event. */
|
||||||
gui_mch_update();
|
gui_mch_update();
|
||||||
apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED,
|
apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED,
|
||||||
NULL, NULL, FALSE, curbuf);
|
NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
--recursive;
|
--recursive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2954,7 +2952,7 @@ gui_wait_for_chars_or_timer(long wtime)
|
|||||||
gui_wait_for_chars(long wtime, int tb_change_cnt)
|
gui_wait_for_chars(long wtime, int tb_change_cnt)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
#if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD)
|
#if defined(ELAPSED_FUNC)
|
||||||
ELAPSED_TYPE start_tv;
|
ELAPSED_TYPE start_tv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2986,7 +2984,7 @@ gui_wait_for_chars(long wtime, int tb_change_cnt)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD)
|
#if defined(ELAPSED_FUNC)
|
||||||
ELAPSED_INIT(start_tv);
|
ELAPSED_INIT(start_tv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3003,11 +3001,10 @@ gui_wait_for_chars(long wtime, int tb_change_cnt)
|
|||||||
*/
|
*/
|
||||||
if (gui_wait_for_chars_or_timer(p_ut) == OK)
|
if (gui_wait_for_chars_or_timer(p_ut) == OK)
|
||||||
retval = OK;
|
retval = OK;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else if (trigger_cursorhold()
|
else if (trigger_cursorhold()
|
||||||
# ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
&& ELAPSED_FUNC(start_tv) >= p_ut
|
&& ELAPSED_FUNC(start_tv) >= p_ut
|
||||||
# endif
|
#endif
|
||||||
&& typebuf.tb_change_cnt == tb_change_cnt)
|
&& typebuf.tb_change_cnt == tb_change_cnt)
|
||||||
{
|
{
|
||||||
char_u buf[3];
|
char_u buf[3];
|
||||||
@ -3020,7 +3017,6 @@ gui_wait_for_chars(long wtime, int tb_change_cnt)
|
|||||||
|
|
||||||
retval = OK;
|
retval = OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt)
|
if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt)
|
||||||
{
|
{
|
||||||
@ -5131,34 +5127,24 @@ no_console_input(void)
|
|||||||
void
|
void
|
||||||
gui_update_screen(void)
|
gui_update_screen(void)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
linenr_T conceal_old_cursor_line = 0;
|
linenr_T conceal_old_cursor_line = 0;
|
||||||
linenr_T conceal_new_cursor_line = 0;
|
linenr_T conceal_new_cursor_line = 0;
|
||||||
int conceal_update_lines = FALSE;
|
int conceal_update_lines = FALSE;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
update_topline();
|
update_topline();
|
||||||
validate_cursor();
|
validate_cursor();
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
|
||||||
/* Trigger CursorMoved if the cursor moved. */
|
/* Trigger CursorMoved if the cursor moved. */
|
||||||
if (!finish_op && (
|
if (!finish_op && (has_cursormoved()
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
has_cursormoved()
|
|
||||||
# endif
|
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
|
|
||||||
||
|
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
curwin->w_p_cole > 0
|
|| curwin->w_p_cole > 0
|
||||||
# endif
|
# endif
|
||||||
)
|
) && !EQUAL_POS(last_cursormoved, curwin->w_cursor))
|
||||||
&& !EQUAL_POS(last_cursormoved, curwin->w_cursor))
|
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (has_cursormoved())
|
if (has_cursormoved())
|
||||||
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL, FALSE, curbuf);
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
if (curwin->w_p_cole > 0)
|
if (curwin->w_p_cole > 0)
|
||||||
{
|
{
|
||||||
@ -5169,11 +5155,10 @@ gui_update_screen(void)
|
|||||||
# endif
|
# endif
|
||||||
last_cursormoved = curwin->w_cursor;
|
last_cursormoved = curwin->w_cursor;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
update_screen(0); /* may need to update the screen */
|
update_screen(0); /* may need to update the screen */
|
||||||
setcursor();
|
setcursor();
|
||||||
# if defined(FEAT_CONCEAL)
|
# ifdef FEAT_CONCEAL
|
||||||
if (conceal_update_lines
|
if (conceal_update_lines
|
||||||
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
||||||
|| conceal_cursor_line(curwin)
|
|| conceal_cursor_line(curwin)
|
||||||
|
@ -6232,7 +6232,7 @@ char_u *FullPathFromFSSpec_save(FSSpec file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(FEAT_MBYTE) || defined(PROTO)) && defined(USE_CARBONKEYHANDLER)
|
#if (defined(FEAT_MBYTE) && defined(USE_CARBONKEYHANDLER)) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Input Method Control functions.
|
* Input Method Control functions.
|
||||||
*/
|
*/
|
||||||
|
@ -1147,17 +1147,15 @@ cs_find_common(
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (*qfpos != '0'
|
if (*qfpos != '0'
|
||||||
&& apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
|
&& apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
# endif
|
# endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1251,10 +1249,8 @@ cs_find_common(
|
|||||||
postponed_split = 0;
|
postponed_split = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope",
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope",
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
# endif
|
|
||||||
if (use_ll)
|
if (use_ll)
|
||||||
/*
|
/*
|
||||||
* In the location list window, use the displayed location
|
* In the location list window, use the displayed location
|
||||||
|
@ -1480,14 +1480,12 @@ server_parse_message(
|
|||||||
ga_concat(&(r->strings), str);
|
ga_concat(&(r->strings), str);
|
||||||
ga_append(&(r->strings), NUL);
|
ga_append(&(r->strings), NUL);
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{
|
{
|
||||||
char_u winstr[30];
|
char_u winstr[30];
|
||||||
|
|
||||||
sprintf((char *)winstr, "0x%x", (unsigned int)win);
|
sprintf((char *)winstr, "0x%x", (unsigned int)win);
|
||||||
apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf);
|
apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
vim_free(tofree);
|
vim_free(tofree);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
69
src/main.c
69
src/main.c
@ -748,10 +748,8 @@ vim_main2(void)
|
|||||||
if (exmode_active)
|
if (exmode_active)
|
||||||
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
TIME_MSG("BufEnter autocommands");
|
TIME_MSG("BufEnter autocommands");
|
||||||
#endif
|
|
||||||
setpcmark();
|
setpcmark();
|
||||||
|
|
||||||
#ifdef FEAT_QUICKFIX
|
#ifdef FEAT_QUICKFIX
|
||||||
@ -843,10 +841,8 @@ vim_main2(void)
|
|||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
|
set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
||||||
TIME_MSG("VimEnter autocommands");
|
TIME_MSG("VimEnter autocommands");
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD)
|
#if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD)
|
||||||
/* Adjust default register name for "unnamed" in 'clipboard'. Can only be
|
/* Adjust default register name for "unnamed" in 'clipboard'. Can only be
|
||||||
@ -1162,50 +1158,33 @@ main_loop(
|
|||||||
skip_redraw = FALSE;
|
skip_redraw = FALSE;
|
||||||
else if (do_redraw || stuff_empty())
|
else if (do_redraw || stuff_empty())
|
||||||
{
|
{
|
||||||
# ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
/* If ui_breakcheck() was used a resize may have been postponed. */
|
/* If ui_breakcheck() was used a resize may have been postponed. */
|
||||||
gui_may_resize_shell();
|
gui_may_resize_shell();
|
||||||
# endif
|
#endif
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_CONCEAL)
|
|
||||||
/* Trigger CursorMoved if the cursor moved. */
|
/* Trigger CursorMoved if the cursor moved. */
|
||||||
if (!finish_op && (
|
if (!finish_op && (
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
has_cursormoved()
|
has_cursormoved()
|
||||||
# endif
|
#ifdef FEAT_CONCEAL
|
||||||
# if defined(FEAT_AUTOCMD) && defined(FEAT_CONCEAL)
|
|| curwin->w_p_cole > 0
|
||||||
||
|
#endif
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
|
||||||
curwin->w_p_cole > 0
|
|
||||||
# endif
|
|
||||||
)
|
)
|
||||||
# ifdef FEAT_AUTOCMD
|
&& !EQUAL_POS(last_cursormoved, curwin->w_cursor))
|
||||||
&& !EQUAL_POS(last_cursormoved, curwin->w_cursor)
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (has_cursormoved())
|
if (has_cursormoved())
|
||||||
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL,
|
apply_autocmds(EVENT_CURSORMOVED, NULL, NULL,
|
||||||
FALSE, curbuf);
|
FALSE, curbuf);
|
||||||
# endif
|
|
||||||
# ifdef FEAT_CONCEAL
|
# ifdef FEAT_CONCEAL
|
||||||
if (curwin->w_p_cole > 0)
|
if (curwin->w_p_cole > 0)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
conceal_old_cursor_line = last_cursormoved.lnum;
|
conceal_old_cursor_line = last_cursormoved.lnum;
|
||||||
# endif
|
|
||||||
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
||||||
conceal_update_lines = TRUE;
|
conceal_update_lines = TRUE;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
last_cursormoved = curwin->w_cursor;
|
last_cursormoved = curwin->w_cursor;
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger TextChanged if b:changedtick differs. */
|
/* Trigger TextChanged if b:changedtick differs. */
|
||||||
if (!finish_op && has_textchanged()
|
if (!finish_op && has_textchanged()
|
||||||
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf))
|
&& curbuf->b_last_changedtick != CHANGEDTICK(curbuf))
|
||||||
@ -1213,7 +1192,6 @@ main_loop(
|
|||||||
apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TEXTCHANGED, NULL, NULL, FALSE, curbuf);
|
||||||
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
curbuf->b_last_changedtick = CHANGEDTICK(curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND)
|
#if defined(FEAT_DIFF) && defined(FEAT_SCROLLBIND)
|
||||||
/* Scroll-binding for diff mode may have been postponed until
|
/* Scroll-binding for diff mode may have been postponed until
|
||||||
@ -1292,7 +1270,7 @@ main_loop(
|
|||||||
may_clear_sb_text(); /* clear scroll-back text on next msg */
|
may_clear_sb_text(); /* clear scroll-back text on next msg */
|
||||||
showruler(FALSE);
|
showruler(FALSE);
|
||||||
|
|
||||||
# if defined(FEAT_CONCEAL)
|
#if defined(FEAT_CONCEAL)
|
||||||
if (conceal_update_lines
|
if (conceal_update_lines
|
||||||
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
||||||
|| conceal_cursor_line(curwin)
|
|| conceal_cursor_line(curwin)
|
||||||
@ -1307,7 +1285,7 @@ main_loop(
|
|||||||
mch_enable_flush();
|
mch_enable_flush();
|
||||||
curwin->w_valid &= ~VALID_CROW;
|
curwin->w_valid &= ~VALID_CROW;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
setcursor();
|
setcursor();
|
||||||
cursor_on();
|
cursor_on();
|
||||||
|
|
||||||
@ -1405,11 +1383,10 @@ getout_preserve_modified(int exitval)
|
|||||||
void
|
void
|
||||||
getout(int exitval)
|
getout(int exitval)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
tabpage_T *tp;
|
||||||
|
tabpage_T *next_tp;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp, *next_tp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exiting = TRUE;
|
exiting = TRUE;
|
||||||
|
|
||||||
@ -1434,8 +1411,7 @@ getout(int exitval)
|
|||||||
msg_didany = FALSE;
|
msg_didany = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
if (v_dying <= 1)
|
||||||
if (get_vim_var_nr(VV_DYING) <= 1)
|
|
||||||
{
|
{
|
||||||
/* Trigger BufWinLeave for all windows, but only once per buffer. */
|
/* Trigger BufWinLeave for all windows, but only once per buffer. */
|
||||||
for (tp = first_tabpage; tp != NULL; tp = next_tp)
|
for (tp = first_tabpage; tp != NULL; tp = next_tp)
|
||||||
@ -1479,7 +1455,6 @@ getout(int exitval)
|
|||||||
}
|
}
|
||||||
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_VIMINFO
|
#ifdef FEAT_VIMINFO
|
||||||
if (*p_viminfo != NUL)
|
if (*p_viminfo != NUL)
|
||||||
@ -1487,10 +1462,8 @@ getout(int exitval)
|
|||||||
write_viminfo(NULL, FALSE);
|
write_viminfo(NULL, FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
if (v_dying <= 1)
|
||||||
if (get_vim_var_nr(VV_DYING) <= 1)
|
|
||||||
apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_PROFILE
|
#ifdef FEAT_PROFILE
|
||||||
profile_dump();
|
profile_dump();
|
||||||
@ -1507,13 +1480,11 @@ getout(int exitval)
|
|||||||
wait_return(FALSE);
|
wait_return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Position the cursor again, the autocommands may have moved it */
|
/* Position the cursor again, the autocommands may have moved it */
|
||||||
# ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
if (!gui.in_use)
|
if (!gui.in_use)
|
||||||
# endif
|
|
||||||
windgoto((int)Rows - 1, 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
windgoto((int)Rows - 1, 0);
|
||||||
|
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
job_stop_on_exit();
|
job_stop_on_exit();
|
||||||
@ -2701,13 +2672,11 @@ create_windows(mparm_T *parmp UNUSED)
|
|||||||
* Commands in the .vimrc might have loaded a file or split the window.
|
* Commands in the .vimrc might have loaded a file or split the window.
|
||||||
* Watch out for autocommands that delete a window.
|
* Watch out for autocommands that delete a window.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Don't execute Win/Buf Enter/Leave autocommands here
|
* Don't execute Win/Buf Enter/Leave autocommands here
|
||||||
*/
|
*/
|
||||||
++autocmd_no_enter;
|
++autocmd_no_enter;
|
||||||
++autocmd_no_leave;
|
++autocmd_no_leave;
|
||||||
#endif
|
|
||||||
dorewind = TRUE;
|
dorewind = TRUE;
|
||||||
while (done++ < 1000)
|
while (done++ < 1000)
|
||||||
{
|
{
|
||||||
@ -2767,9 +2736,7 @@ create_windows(mparm_T *parmp UNUSED)
|
|||||||
else
|
else
|
||||||
handle_swap_exists(NULL);
|
handle_swap_exists(NULL);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
dorewind = TRUE; /* start again */
|
dorewind = TRUE; /* start again */
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
ui_breakcheck();
|
ui_breakcheck();
|
||||||
if (got_int)
|
if (got_int)
|
||||||
@ -2783,10 +2750,8 @@ create_windows(mparm_T *parmp UNUSED)
|
|||||||
else
|
else
|
||||||
curwin = firstwin;
|
curwin = firstwin;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_enter;
|
--autocmd_no_enter;
|
||||||
--autocmd_no_leave;
|
--autocmd_no_leave;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2804,13 +2769,11 @@ edit_buffers(
|
|||||||
int advance = TRUE;
|
int advance = TRUE;
|
||||||
win_T *win;
|
win_T *win;
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Don't execute Win/Buf Enter/Leave autocommands here
|
* Don't execute Win/Buf Enter/Leave autocommands here
|
||||||
*/
|
*/
|
||||||
++autocmd_no_enter;
|
++autocmd_no_enter;
|
||||||
++autocmd_no_leave;
|
++autocmd_no_leave;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* When w_arg_idx is -1 remove the window (see create_windows()). */
|
/* When w_arg_idx is -1 remove the window (see create_windows()). */
|
||||||
if (curwin->w_arg_idx == -1)
|
if (curwin->w_arg_idx == -1)
|
||||||
@ -2891,9 +2854,7 @@ edit_buffers(
|
|||||||
|
|
||||||
if (parmp->window_layout == WIN_TABS)
|
if (parmp->window_layout == WIN_TABS)
|
||||||
goto_tabpage(1);
|
goto_tabpage(1);
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_enter;
|
--autocmd_no_enter;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* make the first window the current window */
|
/* make the first window the current window */
|
||||||
win = firstwin;
|
win = firstwin;
|
||||||
@ -2911,9 +2872,7 @@ edit_buffers(
|
|||||||
#endif
|
#endif
|
||||||
win_enter(win, FALSE);
|
win_enter(win, FALSE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
--autocmd_no_leave;
|
--autocmd_no_leave;
|
||||||
#endif
|
|
||||||
TIME_MSG("editing files in windows");
|
TIME_MSG("editing files in windows");
|
||||||
if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS)
|
if (parmp->window_count > 1 && parmp->window_layout != WIN_TABS)
|
||||||
win_equal(curwin, FALSE, 'b'); /* adjust heights */
|
win_equal(curwin, FALSE, 'b'); /* adjust heights */
|
||||||
|
19
src/mbyte.c
19
src/mbyte.c
@ -799,11 +799,9 @@ codepage_invalid:
|
|||||||
fix_arg_enc();
|
fix_arg_enc();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Fire an autocommand to let people do custom font setup. This must be
|
/* Fire an autocommand to let people do custom font setup. This must be
|
||||||
* after Vim has been setup for the new encoding. */
|
* after Vim has been setup for the new encoding. */
|
||||||
apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf);
|
apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_SPELL
|
#ifdef FEAT_SPELL
|
||||||
/* Need to reload spell dictionaries */
|
/* Need to reload spell dictionaries */
|
||||||
@ -4792,7 +4790,8 @@ iconv_end(void)
|
|||||||
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
|
# define USE_IMSTATUSFUNC (*p_imsf != NUL)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE)
|
#if defined(FEAT_EVAL) && defined(FEAT_MBYTE) \
|
||||||
|
&& (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM))
|
||||||
static void
|
static void
|
||||||
call_imactivatefunc(int active)
|
call_imactivatefunc(int active)
|
||||||
{
|
{
|
||||||
@ -4811,11 +4810,7 @@ call_imstatusfunc(void)
|
|||||||
int is_active;
|
int is_active;
|
||||||
|
|
||||||
/* FIXME: Don't execute user function in unsafe situation. */
|
/* FIXME: Don't execute user function in unsafe situation. */
|
||||||
if (exiting
|
if (exiting || is_autocmd_blocked())
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
|| is_autocmd_blocked()
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* FIXME: :py print 'xxx' is shown duplicate result.
|
/* FIXME: :py print 'xxx' is shown duplicate result.
|
||||||
* Use silent to avoid it. */
|
* Use silent to avoid it. */
|
||||||
@ -5698,11 +5693,11 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
|
|||||||
void
|
void
|
||||||
xim_reset(void)
|
xim_reset(void)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
if (USE_IMACTIVATEFUNC)
|
if (USE_IMACTIVATEFUNC)
|
||||||
call_imactivatefunc(im_is_active);
|
call_imactivatefunc(im_is_active);
|
||||||
else
|
else
|
||||||
#endif
|
# endif
|
||||||
if (xic != NULL)
|
if (xic != NULL)
|
||||||
{
|
{
|
||||||
gtk_im_context_reset(xic);
|
gtk_im_context_reset(xic);
|
||||||
@ -6482,11 +6477,11 @@ xim_get_status_area_height(void)
|
|||||||
|
|
||||||
#else /* !defined(FEAT_XIM) */
|
#else /* !defined(FEAT_XIM) */
|
||||||
|
|
||||||
# if !defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))
|
# ifdef IME_WITHOUT_XIM
|
||||||
static int im_was_set_active = FALSE;
|
static int im_was_set_active = FALSE;
|
||||||
|
|
||||||
int
|
int
|
||||||
im_get_status()
|
im_get_status(void)
|
||||||
{
|
{
|
||||||
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
# if defined(FEAT_MBYTE) && defined(FEAT_EVAL)
|
||||||
if (USE_IMSTATUSFUNC)
|
if (USE_IMSTATUSFUNC)
|
||||||
|
@ -1732,13 +1732,11 @@ theend:
|
|||||||
}
|
}
|
||||||
if (serious_error && called_from_main)
|
if (serious_error && called_from_main)
|
||||||
ml_close(curbuf, TRUE);
|
ml_close(curbuf, TRUE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
apply_autocmds(EVENT_BUFREADPOST, NULL, curbuf->b_fname, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFREADPOST, NULL, curbuf->b_fname, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_BUFWINENTER, NULL, curbuf->b_fname, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWINENTER, NULL, curbuf->b_fname, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4071,7 +4069,7 @@ attention_message(
|
|||||||
--no_wait_return;
|
--no_wait_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
static int do_swapexists(buf_T *buf, char_u *fname);
|
static int do_swapexists(buf_T *buf, char_u *fname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4450,7 +4448,7 @@ findswapname(
|
|||||||
#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
|
#if (defined(UNIX) || defined(VMS)) && (defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG))
|
||||||
process_still_running = FALSE;
|
process_still_running = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
/*
|
/*
|
||||||
* If there is an SwapExists autocommand and we can handle
|
* If there is an SwapExists autocommand and we can handle
|
||||||
* the response, trigger it. It may return 0 to ask the
|
* the response, trigger it. It may return 0 to ask the
|
||||||
|
@ -1907,7 +1907,6 @@ show_popupmenu(void)
|
|||||||
return;
|
return;
|
||||||
mode = menu_mode_chars[mode];
|
mode = menu_mode_chars[mode];
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
{
|
{
|
||||||
char_u ename[2];
|
char_u ename[2];
|
||||||
|
|
||||||
@ -1915,7 +1914,6 @@ show_popupmenu(void)
|
|||||||
ename[1] = NUL;
|
ename[1] = NUL;
|
||||||
apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_MENUPOPUP, ename, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
for (menu = root_menu; menu != NULL; menu = menu->next)
|
for (menu = root_menu; menu != NULL; menu = menu->next)
|
||||||
if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode)
|
if (STRNCMP("PopUp", menu->name, 5) == 0 && menu->name[5] == mode)
|
||||||
|
@ -3183,12 +3183,10 @@ changed_common(
|
|||||||
if (must_redraw < VALID)
|
if (must_redraw < VALID)
|
||||||
must_redraw = VALID;
|
must_redraw = VALID;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* when the cursor line is changed always trigger CursorMoved */
|
/* when the cursor line is changed always trigger CursorMoved */
|
||||||
if (lnum <= curwin->w_cursor.lnum
|
if (lnum <= curwin->w_cursor.lnum
|
||||||
&& lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum)
|
&& lnume + (xtra < 0 ? -xtra : xtra) > curwin->w_cursor.lnum)
|
||||||
last_cursormoved.lnum = 0;
|
last_cursormoved.lnum = 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3252,18 +3250,14 @@ change_warning(
|
|||||||
|
|
||||||
if (curbuf->b_did_warn == FALSE
|
if (curbuf->b_did_warn == FALSE
|
||||||
&& curbufIsChanged() == 0
|
&& curbufIsChanged() == 0
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !autocmd_busy
|
&& !autocmd_busy
|
||||||
#endif
|
|
||||||
&& curbuf->b_p_ro)
|
&& curbuf->b_p_ro)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
++curbuf_lock;
|
++curbuf_lock;
|
||||||
apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_FILECHANGEDRO, NULL, NULL, FALSE, curbuf);
|
||||||
--curbuf_lock;
|
--curbuf_lock;
|
||||||
if (!curbuf->b_p_ro)
|
if (!curbuf->b_p_ro)
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Do what msg() does, but with a column offset if the warning should
|
* Do what msg() does, but with a column offset if the warning should
|
||||||
* be after the mode message.
|
* be after the mode message.
|
||||||
|
@ -1099,10 +1099,8 @@ free_all_mem(void)
|
|||||||
return;
|
return;
|
||||||
entered_free_all_mem = TRUE;
|
entered_free_all_mem = TRUE;
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't want to trigger autocommands from here on. */
|
/* Don't want to trigger autocommands from here on. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
||||||
p_ea = FALSE;
|
p_ea = FALSE;
|
||||||
@ -1157,9 +1155,7 @@ free_all_mem(void)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Obviously named calls. */
|
/* Obviously named calls. */
|
||||||
# if defined(FEAT_AUTOCMD)
|
|
||||||
free_all_autocmds();
|
free_all_autocmds();
|
||||||
# endif
|
|
||||||
clear_termcodes();
|
clear_termcodes();
|
||||||
free_all_marks();
|
free_all_marks();
|
||||||
alist_clear(&global_alist);
|
alist_clear(&global_alist);
|
||||||
@ -3403,11 +3399,9 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd UNUSED)
|
|||||||
vim_strncpy(dir, fname, MAXPATHL - 1);
|
vim_strncpy(dir, fname, MAXPATHL - 1);
|
||||||
*gettail_sep(dir) = NUL;
|
*gettail_sep(dir) = NUL;
|
||||||
res = mch_chdir((char *)dir) == 0 ? OK : FAIL;
|
res = mch_chdir((char *)dir) == 0 ? OK : FAIL;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (res == OK && trigger_autocmd != NULL)
|
if (res == OK && trigger_autocmd != NULL)
|
||||||
apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd,
|
apply_autocmds(EVENT_DIRCHANGED, (char_u *)trigger_autocmd,
|
||||||
dir, FALSE, curbuf);
|
dir, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -538,9 +538,7 @@ set_topline(win_T *wp, linenr_T lnum)
|
|||||||
/* Approximate the value of w_botline */
|
/* Approximate the value of w_botline */
|
||||||
wp->w_botline += lnum - wp->w_topline;
|
wp->w_botline += lnum - wp->w_topline;
|
||||||
wp->w_topline = lnum;
|
wp->w_topline = lnum;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
wp->w_topline_was_set = TRUE;
|
wp->w_topline_was_set = TRUE;
|
||||||
#endif
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
wp->w_topfill = 0;
|
wp->w_topfill = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1581,9 +1581,7 @@ nb_do_cmd(
|
|||||||
do_update = 1;
|
do_update = 1;
|
||||||
buf->initDone = TRUE;
|
buf->initDone = TRUE;
|
||||||
nb_set_curbuf(buf->bufp);
|
nb_set_curbuf(buf->bufp);
|
||||||
#if defined(FEAT_AUTOCMD)
|
|
||||||
apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp);
|
apply_autocmds(EVENT_BUFREADPOST, 0, 0, FALSE, buf->bufp);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* handle any postponed key commands */
|
/* handle any postponed key commands */
|
||||||
handle_key_queue();
|
handle_key_queue();
|
||||||
@ -2160,17 +2158,13 @@ nb_do_cmd(
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, buf->bufp);
|
set_bufref(&bufref, buf->bufp);
|
||||||
#endif
|
|
||||||
buf_write_all(buf->bufp, FALSE);
|
buf_write_all(buf->bufp, FALSE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* an autocommand may have deleted the buffer */
|
/* an autocommand may have deleted the buffer */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
buf->bufp = NULL;
|
buf->bufp = NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
32
src/normal.c
32
src/normal.c
@ -169,9 +169,7 @@ static void nv_nbcmd(cmdarg_T *cap);
|
|||||||
#ifdef FEAT_DND
|
#ifdef FEAT_DND
|
||||||
static void nv_drop(cmdarg_T *cap);
|
static void nv_drop(cmdarg_T *cap);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static void nv_cursorhold(cmdarg_T *cap);
|
static void nv_cursorhold(cmdarg_T *cap);
|
||||||
#endif
|
|
||||||
static void get_op_vcol(oparg_T *oap, colnr_T col, int initial);
|
static void get_op_vcol(oparg_T *oap, colnr_T col, int initial);
|
||||||
|
|
||||||
static char *e_noident = N_("E349: No identifier under cursor");
|
static char *e_noident = N_("E349: No identifier under cursor");
|
||||||
@ -424,9 +422,7 @@ static const struct nv_cmd
|
|||||||
#ifdef FEAT_DND
|
#ifdef FEAT_DND
|
||||||
{K_DROP, nv_drop, NV_STS, 0},
|
{K_DROP, nv_drop, NV_STS, 0},
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0},
|
{K_CURSORHOLD, nv_cursorhold, NV_KEEPREG, 0},
|
||||||
#endif
|
|
||||||
{K_PS, nv_edit, 0, 0},
|
{K_PS, nv_edit, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -595,7 +591,6 @@ normal_cmd(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Restore counts from before receiving K_CURSORHOLD. This means after
|
/* Restore counts from before receiving K_CURSORHOLD. This means after
|
||||||
* typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not
|
* typing "3", handling K_CURSORHOLD and then typing "2" we get "32", not
|
||||||
* "3 * 2". */
|
* "3 * 2". */
|
||||||
@ -606,7 +601,6 @@ normal_cmd(
|
|||||||
oap->prev_opcount = 0;
|
oap->prev_opcount = 0;
|
||||||
oap->prev_count0 = 0;
|
oap->prev_count0 = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
mapped_len = typebuf_maplen();
|
mapped_len = typebuf_maplen();
|
||||||
|
|
||||||
@ -737,7 +731,6 @@ getcount:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (c == K_CURSORHOLD)
|
if (c == K_CURSORHOLD)
|
||||||
{
|
{
|
||||||
/* Save the count values so that ca.opcount and ca.count0 are exactly
|
/* Save the count values so that ca.opcount and ca.count0 are exactly
|
||||||
@ -745,9 +738,7 @@ getcount:
|
|||||||
oap->prev_opcount = ca.opcount;
|
oap->prev_opcount = ca.opcount;
|
||||||
oap->prev_count0 = ca.count0;
|
oap->prev_count0 = ca.count0;
|
||||||
}
|
}
|
||||||
else
|
else if (ca.opcount != 0)
|
||||||
#endif
|
|
||||||
if (ca.opcount != 0)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If we're in the middle of an operator (including after entering a
|
* If we're in the middle of an operator (including after entering a
|
||||||
@ -808,10 +799,8 @@ getcount:
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
goto normal_end;
|
goto normal_end;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked())
|
if ((nv_cmds[idx].cmd_flags & NV_NCW) && curbuf_locked())
|
||||||
goto normal_end;
|
goto normal_end;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In Visual/Select mode, a few keys are handled in a special way.
|
* In Visual/Select mode, a few keys are handled in a special way.
|
||||||
@ -892,17 +881,15 @@ getcount:
|
|||||||
int lit = FALSE; /* get extra character literally */
|
int lit = FALSE; /* get extra character literally */
|
||||||
int langmap_active = FALSE; /* using :lmap mappings */
|
int langmap_active = FALSE; /* using :lmap mappings */
|
||||||
int lang; /* getting a text character */
|
int lang; /* getting a text character */
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
int save_smd; /* saved value of p_smd */
|
int save_smd; /* saved value of p_smd */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
++no_mapping;
|
++no_mapping;
|
||||||
++allow_keys; /* no mapping for nchar, but allow key codes */
|
++allow_keys; /* no mapping for nchar, but allow key codes */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't generate a CursorHold event here, most commands can't handle
|
/* Don't generate a CursorHold event here, most commands can't handle
|
||||||
* it, e.g., nv_replace(), nv_csearch(). */
|
* it, e.g., nv_replace(), nv_csearch(). */
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
#endif
|
|
||||||
if (ca.cmdchar == 'g')
|
if (ca.cmdchar == 'g')
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -957,7 +944,7 @@ getcount:
|
|||||||
State = LANGMAP;
|
State = LANGMAP;
|
||||||
langmap_active = TRUE;
|
langmap_active = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
save_smd = p_smd;
|
save_smd = p_smd;
|
||||||
p_smd = FALSE; /* Don't let the IM code show the mode here */
|
p_smd = FALSE; /* Don't let the IM code show the mode here */
|
||||||
if (lang && curbuf->b_p_iminsert == B_IMODE_IM)
|
if (lang && curbuf->b_p_iminsert == B_IMODE_IM)
|
||||||
@ -973,7 +960,7 @@ getcount:
|
|||||||
++allow_keys;
|
++allow_keys;
|
||||||
State = NORMAL_BUSY;
|
State = NORMAL_BUSY;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
if (lang)
|
if (lang)
|
||||||
{
|
{
|
||||||
if (curbuf->b_p_iminsert != B_IMODE_LMAP)
|
if (curbuf->b_p_iminsert != B_IMODE_LMAP)
|
||||||
@ -1102,10 +1089,8 @@ getcount:
|
|||||||
if (need_flushbuf)
|
if (need_flushbuf)
|
||||||
out_flush();
|
out_flush();
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (ca.cmdchar != K_IGNORE)
|
if (ca.cmdchar != K_IGNORE)
|
||||||
did_cursorhold = FALSE;
|
did_cursorhold = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
State = NORMAL;
|
State = NORMAL;
|
||||||
|
|
||||||
@ -1278,10 +1263,7 @@ normal_end:
|
|||||||
|
|
||||||
#ifdef FEAT_CMDL_INFO
|
#ifdef FEAT_CMDL_INFO
|
||||||
if (oap->op_type == OP_NOP && oap->regname == 0
|
if (oap->op_type == OP_NOP && oap->regname == 0
|
||||||
# ifdef FEAT_AUTOCMD
|
&& ca.cmdchar != K_CURSORHOLD)
|
||||||
&& ca.cmdchar != K_CURSORHOLD
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
clear_showcmd();
|
clear_showcmd();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -6264,13 +6246,11 @@ nv_gotofile(cmdarg_T *cap)
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
{
|
{
|
||||||
clearop(cap->oap);
|
clearop(cap->oap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
ptr = grab_file_name(cap->count1, &lnum);
|
ptr = grab_file_name(cap->count1, &lnum);
|
||||||
|
|
||||||
@ -9597,7 +9577,6 @@ nv_drop(cmdarg_T *cap UNUSED)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Trigger CursorHold event.
|
* Trigger CursorHold event.
|
||||||
* When waiting for a character for 'updatetime' K_CURSORHOLD is put in the
|
* When waiting for a character for 'updatetime' K_CURSORHOLD is put in the
|
||||||
@ -9610,7 +9589,6 @@ nv_cursorhold(cmdarg_T *cap)
|
|||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */
|
cap->retval |= CA_COMMAND_BUSY; /* don't call edit() now */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate start/end virtual columns for operating in block mode.
|
* Calculate start/end virtual columns for operating in block mode.
|
||||||
|
@ -1651,7 +1651,7 @@ shift_delete_registers()
|
|||||||
y_regs[1].y_array = NULL; /* set register one to empty */
|
y_regs[1].y_array = NULL; /* set register one to empty */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
static void
|
static void
|
||||||
yank_do_autocmd(oparg_T *oap, yankreg_T *reg)
|
yank_do_autocmd(oparg_T *oap, yankreg_T *reg)
|
||||||
{
|
{
|
||||||
@ -1866,7 +1866,7 @@ op_delete(oparg_T *oap)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
if (did_yank && has_textyankpost())
|
if (did_yank && has_textyankpost())
|
||||||
yank_do_autocmd(oap, y_current);
|
yank_do_autocmd(oap, y_current);
|
||||||
#endif
|
#endif
|
||||||
@ -3350,7 +3350,7 @@ op_yank(oparg_T *oap, int deleting, int mess)
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
if (!deleting && has_textyankpost())
|
if (!deleting && has_textyankpost())
|
||||||
yank_do_autocmd(oap, y_current);
|
yank_do_autocmd(oap, y_current);
|
||||||
#endif
|
#endif
|
||||||
@ -3493,11 +3493,9 @@ do_put(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Autocommands may be executed when saving lines for undo, which may make
|
/* Autocommands may be executed when saving lines for undo, which may make
|
||||||
* y_array invalid. Start undo now to avoid that. */
|
* y_array invalid. Start undo now to avoid that. */
|
||||||
u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
|
u_save(curwin->w_cursor.lnum, curwin->w_cursor.lnum + 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (insert_string != NULL)
|
if (insert_string != NULL)
|
||||||
{
|
{
|
||||||
|
81
src/option.c
81
src/option.c
@ -114,9 +114,7 @@
|
|||||||
#define PV_FF OPT_BUF(BV_FF)
|
#define PV_FF OPT_BUF(BV_FF)
|
||||||
#define PV_FLP OPT_BUF(BV_FLP)
|
#define PV_FLP OPT_BUF(BV_FLP)
|
||||||
#define PV_FO OPT_BUF(BV_FO)
|
#define PV_FO OPT_BUF(BV_FO)
|
||||||
#ifdef FEAT_AUTOCMD
|
#define PV_FT OPT_BUF(BV_FT)
|
||||||
# define PV_FT OPT_BUF(BV_FT)
|
|
||||||
#endif
|
|
||||||
#define PV_IMI OPT_BUF(BV_IMI)
|
#define PV_IMI OPT_BUF(BV_IMI)
|
||||||
#define PV_IMS OPT_BUF(BV_IMS)
|
#define PV_IMS OPT_BUF(BV_IMS)
|
||||||
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
||||||
@ -319,9 +317,7 @@ static char_u *p_fenc;
|
|||||||
static char_u *p_ff;
|
static char_u *p_ff;
|
||||||
static char_u *p_fo;
|
static char_u *p_fo;
|
||||||
static char_u *p_flp;
|
static char_u *p_flp;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static char_u *p_ft;
|
static char_u *p_ft;
|
||||||
#endif
|
|
||||||
static long p_iminsert;
|
static long p_iminsert;
|
||||||
static long p_imsearch;
|
static long p_imsearch;
|
||||||
#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
#if defined(FEAT_FIND_ID) && defined(FEAT_EVAL)
|
||||||
@ -1125,11 +1121,7 @@ static struct vimoption options[] =
|
|||||||
(char_u *)&p_ek, PV_NONE,
|
(char_u *)&p_ek, PV_NONE,
|
||||||
{(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT},
|
{(char_u *)FALSE, (char_u *)TRUE} SCRIPTID_INIT},
|
||||||
{"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
|
{"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
(char_u *)&p_ei, PV_NONE,
|
(char_u *)&p_ei, PV_NONE,
|
||||||
#else
|
|
||||||
(char_u *)NULL, PV_NONE,
|
|
||||||
#endif
|
|
||||||
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
|
{(char_u *)"", (char_u *)0L} SCRIPTID_INIT},
|
||||||
{"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM,
|
{"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM,
|
||||||
(char_u *)&p_et, PV_ET,
|
(char_u *)&p_et, PV_ET,
|
||||||
@ -1174,13 +1166,8 @@ static struct vimoption options[] =
|
|||||||
#endif
|
#endif
|
||||||
(char_u *)0L} SCRIPTID_INIT},
|
(char_u *)0L} SCRIPTID_INIT},
|
||||||
{"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
{"filetype", "ft", P_STRING|P_ALLOCED|P_VI_DEF|P_NOGLOB|P_NFNAME,
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
(char_u *)&p_ft, PV_FT,
|
(char_u *)&p_ft, PV_FT,
|
||||||
{(char_u *)"", (char_u *)0L}
|
{(char_u *)"", (char_u *)0L}
|
||||||
#else
|
|
||||||
(char_u *)NULL, PV_NONE,
|
|
||||||
{(char_u *)0L, (char_u *)0L}
|
|
||||||
#endif
|
|
||||||
SCRIPTID_INIT},
|
SCRIPTID_INIT},
|
||||||
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
|
{"fillchars", "fcs", P_STRING|P_VI_DEF|P_RALL|P_ONECOMMA|P_NODUP,
|
||||||
(char_u *)&p_fcs, PV_NONE,
|
(char_u *)&p_fcs, PV_NONE,
|
||||||
@ -3248,11 +3235,7 @@ static char *(p_scbopt_values[]) = {"ver", "hor", "jump", NULL};
|
|||||||
#endif
|
#endif
|
||||||
static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
|
static char *(p_debug_values[]) = {"msg", "throw", "beep", NULL};
|
||||||
static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
static char *(p_ead_values[]) = {"both", "ver", "hor", NULL};
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", NULL};
|
static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", "acwrite", NULL};
|
||||||
#else
|
|
||||||
static char *(p_buftype_values[]) = {"nofile", "nowrite", "quickfix", "help", "terminal", NULL};
|
|
||||||
#endif
|
|
||||||
static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
static char *(p_bufhidden_values[]) = {"hide", "unload", "delete", "wipe", NULL};
|
||||||
static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
static char *(p_bs_values[]) = {"indent", "eol", "start", NULL};
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
@ -4339,7 +4322,7 @@ set_title_defaults(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
static void
|
static void
|
||||||
trigger_optionsset_string(
|
trigger_optionsset_string(
|
||||||
int opt_idx,
|
int opt_idx,
|
||||||
@ -4830,7 +4813,7 @@ do_set(
|
|||||||
char_u *oldval = NULL; /* previous value if *varp */
|
char_u *oldval = NULL; /* previous value if *varp */
|
||||||
char_u *newval;
|
char_u *newval;
|
||||||
char_u *origval = NULL;
|
char_u *origval = NULL;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
char_u *saved_origval = NULL;
|
char_u *saved_origval = NULL;
|
||||||
char_u *saved_newval = NULL;
|
char_u *saved_newval = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -5184,7 +5167,7 @@ do_set(
|
|||||||
*/
|
*/
|
||||||
*(char_u **)(varp) = newval;
|
*(char_u **)(varp) = newval;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!starting
|
if (!starting
|
||||||
# ifdef FEAT_CRYPT
|
# ifdef FEAT_CRYPT
|
||||||
&& options[opt_idx].indir != PV_KEY
|
&& options[opt_idx].indir != PV_KEY
|
||||||
@ -5207,7 +5190,7 @@ do_set(
|
|||||||
errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
errmsg = did_set_string_option(opt_idx, (char_u **)varp,
|
||||||
new_value_alloced, oldval, errbuf, opt_flags);
|
new_value_alloced, oldval, errbuf, opt_flags);
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (errmsg == NULL)
|
if (errmsg == NULL)
|
||||||
trigger_optionsset_string(opt_idx, opt_flags,
|
trigger_optionsset_string(opt_idx, opt_flags,
|
||||||
saved_origval, saved_newval);
|
saved_origval, saved_newval);
|
||||||
@ -5726,9 +5709,7 @@ check_buf_options(buf_T *buf)
|
|||||||
check_string_option(&buf->b_p_cino);
|
check_string_option(&buf->b_p_cino);
|
||||||
parse_cino(buf);
|
parse_cino(buf);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
check_string_option(&buf->b_p_ft);
|
check_string_option(&buf->b_p_ft);
|
||||||
#endif
|
|
||||||
#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
||||||
check_string_option(&buf->b_p_cinw);
|
check_string_option(&buf->b_p_cinw);
|
||||||
#endif
|
#endif
|
||||||
@ -5982,7 +5963,7 @@ set_string_option(
|
|||||||
char_u *s;
|
char_u *s;
|
||||||
char_u **varp;
|
char_u **varp;
|
||||||
char_u *oldval;
|
char_u *oldval;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
char_u *saved_oldval = NULL;
|
char_u *saved_oldval = NULL;
|
||||||
char_u *saved_newval = NULL;
|
char_u *saved_newval = NULL;
|
||||||
#endif
|
#endif
|
||||||
@ -6002,7 +5983,7 @@ set_string_option(
|
|||||||
oldval = *varp;
|
oldval = *varp;
|
||||||
*varp = s;
|
*varp = s;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!starting
|
if (!starting
|
||||||
# ifdef FEAT_CRYPT
|
# ifdef FEAT_CRYPT
|
||||||
&& options[opt_idx].indir != PV_KEY
|
&& options[opt_idx].indir != PV_KEY
|
||||||
@ -6017,7 +5998,7 @@ set_string_option(
|
|||||||
opt_flags)) == NULL)
|
opt_flags)) == NULL)
|
||||||
did_set_option(opt_idx, opt_flags, TRUE);
|
did_set_option(opt_idx, opt_flags, TRUE);
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
/* call autocommand after handling side effects */
|
/* call autocommand after handling side effects */
|
||||||
if (r == NULL)
|
if (r == NULL)
|
||||||
trigger_optionsset_string(opt_idx, opt_flags,
|
trigger_optionsset_string(opt_idx, opt_flags,
|
||||||
@ -6029,7 +6010,6 @@ set_string_option(
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_KEYMAP) || defined(FEAT_AUTOCMD) || defined(FEAT_SYN_HL)
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if "val" is a valid 'filetype' name.
|
* Return TRUE if "val" is a valid 'filetype' name.
|
||||||
* Also used for 'syntax' and 'keymap'.
|
* Also used for 'syntax' and 'keymap'.
|
||||||
@ -6044,7 +6024,6 @@ valid_filetype(char_u *val)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle string options that need some action to perform when changed.
|
* Handle string options that need some action to perform when changed.
|
||||||
@ -6068,9 +6047,7 @@ did_set_string_option(
|
|||||||
/* set when changing an option that only requires a redraw in the GUI */
|
/* set when changing an option that only requires a redraw in the GUI */
|
||||||
int redraw_gui_only = FALSE;
|
int redraw_gui_only = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int ft_changed = FALSE;
|
int ft_changed = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get the global option to compare with, otherwise we would have to check
|
/* Get the global option to compare with, otherwise we would have to check
|
||||||
* two values for all local options. */
|
* two values for all local options. */
|
||||||
@ -6351,14 +6328,12 @@ did_set_string_option(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* 'eventignore' */
|
/* 'eventignore' */
|
||||||
else if (varp == &p_ei)
|
else if (varp == &p_ei)
|
||||||
{
|
{
|
||||||
if (check_ei() == FAIL)
|
if (check_ei() == FAIL)
|
||||||
errmsg = e_invarg;
|
errmsg = e_invarg;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
/* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
|
/* 'encoding', 'fileencoding', 'termencoding' and 'makeencoding' */
|
||||||
@ -7468,7 +7443,6 @@ did_set_string_option(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else if (gvarp == &p_ft)
|
else if (gvarp == &p_ft)
|
||||||
{
|
{
|
||||||
if (!valid_filetype(*varp))
|
if (!valid_filetype(*varp))
|
||||||
@ -7476,7 +7450,6 @@ did_set_string_option(
|
|||||||
else
|
else
|
||||||
ft_changed = STRCMP(oldval, *varp) != 0;
|
ft_changed = STRCMP(oldval, *varp) != 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
else if (gvarp == &p_syn)
|
else if (gvarp == &p_syn)
|
||||||
@ -7593,18 +7566,17 @@ did_set_string_option(
|
|||||||
else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
|
else if (!(opt_flags & OPT_LOCAL) && opt_flags != OPT_GLOBAL)
|
||||||
set_string_option_global(opt_idx, varp);
|
set_string_option_global(opt_idx, varp);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Trigger the autocommand only after setting the flags.
|
* Trigger the autocommand only after setting the flags.
|
||||||
*/
|
*/
|
||||||
# ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
/* When 'syntax' is set, load the syntax of that name */
|
/* When 'syntax' is set, load the syntax of that name */
|
||||||
if (varp == &(curbuf->b_p_syn))
|
if (varp == &(curbuf->b_p_syn))
|
||||||
{
|
{
|
||||||
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
|
apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn,
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
else if (varp == &(curbuf->b_p_ft))
|
else if (varp == &(curbuf->b_p_ft))
|
||||||
{
|
{
|
||||||
/* 'filetype' is set, trigger the FileType autocommand.
|
/* 'filetype' is set, trigger the FileType autocommand.
|
||||||
@ -7620,7 +7592,6 @@ did_set_string_option(
|
|||||||
varp = NULL;
|
varp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef FEAT_SPELL
|
#ifdef FEAT_SPELL
|
||||||
if (varp == &(curwin->w_s->b_p_spl))
|
if (varp == &(curwin->w_s->b_p_spl))
|
||||||
{
|
{
|
||||||
@ -8280,14 +8251,12 @@ set_bool_option(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* when 'buflisted' changes, trigger autocommands */
|
/* when 'buflisted' changes, trigger autocommands */
|
||||||
else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
|
else if ((int *)varp == &curbuf->b_p_bl && old_value != curbuf->b_p_bl)
|
||||||
{
|
{
|
||||||
apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
|
apply_autocmds(curbuf->b_p_bl ? EVENT_BUFADD : EVENT_BUFDELETE,
|
||||||
NULL, NULL, TRUE, curbuf);
|
NULL, NULL, TRUE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* when 'swf' is set, create swapfile, when reset remove swapfile */
|
/* when 'swf' is set, create swapfile, when reset remove swapfile */
|
||||||
else if ((int *)varp == &curbuf->b_p_swf)
|
else if ((int *)varp == &curbuf->b_p_swf)
|
||||||
@ -8433,9 +8402,7 @@ set_bool_option(
|
|||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
redraw_titles();
|
redraw_titles();
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
modified_was_set = value;
|
modified_was_set = value;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
@ -8529,7 +8496,7 @@ set_bool_option(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef HAVE_INPUT_METHOD
|
||||||
/* 'imdisable' */
|
/* 'imdisable' */
|
||||||
else if ((int *)varp == &p_imdisable)
|
else if ((int *)varp == &p_imdisable)
|
||||||
{
|
{
|
||||||
@ -8739,7 +8706,7 @@ set_bool_option(
|
|||||||
|
|
||||||
options[opt_idx].flags |= P_WAS_SET;
|
options[opt_idx].flags |= P_WAS_SET;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!starting)
|
if (!starting)
|
||||||
{
|
{
|
||||||
char_u buf_old[2], buf_new[2], buf_type[7];
|
char_u buf_old[2], buf_new[2], buf_type[7];
|
||||||
@ -9289,7 +9256,7 @@ set_num_option(
|
|||||||
|
|
||||||
options[opt_idx].flags |= P_WAS_SET;
|
options[opt_idx].flags |= P_WAS_SET;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
if (!starting && errmsg == NULL)
|
if (!starting && errmsg == NULL)
|
||||||
{
|
{
|
||||||
char_u buf_old[11], buf_new[11], buf_type[7];
|
char_u buf_old[11], buf_new[11], buf_type[7];
|
||||||
@ -10139,22 +10106,15 @@ makeset(FILE *fd, int opt_flags, int local_only)
|
|||||||
}
|
}
|
||||||
else /* P_STRING */
|
else /* P_STRING */
|
||||||
{
|
{
|
||||||
#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
|
|
||||||
int do_endif = FALSE;
|
int do_endif = FALSE;
|
||||||
|
|
||||||
/* Don't set 'syntax' and 'filetype' again if the value is
|
/* Don't set 'syntax' and 'filetype' again if the value is
|
||||||
* already right, avoids reloading the syntax file. */
|
* already right, avoids reloading the syntax file. */
|
||||||
if (
|
if (
|
||||||
# if defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
p->indir == PV_SYN
|
p->indir == PV_SYN ||
|
||||||
# if defined(FEAT_AUTOCMD)
|
#endif
|
||||||
||
|
p->indir == PV_FT)
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# if defined(FEAT_AUTOCMD)
|
|
||||||
p->indir == PV_FT
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (fprintf(fd, "if &%s != '%s'", p->fullname,
|
if (fprintf(fd, "if &%s != '%s'", p->fullname,
|
||||||
*(char_u **)(varp)) < 0
|
*(char_u **)(varp)) < 0
|
||||||
@ -10162,17 +10122,14 @@ makeset(FILE *fd, int opt_flags, int local_only)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
do_endif = TRUE;
|
do_endif = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
|
if (put_setstring(fd, cmd, p->fullname, (char_u **)varp,
|
||||||
(p->flags & P_EXPAND) != 0) == FAIL)
|
(p->flags & P_EXPAND) != 0) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#if defined(FEAT_SYN_HL) || defined(FEAT_AUTOCMD)
|
|
||||||
if (do_endif)
|
if (do_endif)
|
||||||
{
|
{
|
||||||
if (put_line(fd, "endif") == FAIL)
|
if (put_line(fd, "endif") == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10783,9 +10740,7 @@ get_varp(struct vimoption *p)
|
|||||||
case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
case PV_FENC: return (char_u *)&(curbuf->b_p_fenc);
|
||||||
#endif
|
#endif
|
||||||
case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
case PV_FF: return (char_u *)&(curbuf->b_p_ff);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
case PV_FT: return (char_u *)&(curbuf->b_p_ft);
|
||||||
#endif
|
|
||||||
case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
case PV_FO: return (char_u *)&(curbuf->b_p_fo);
|
||||||
case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
|
case PV_FLP: return (char_u *)&(curbuf->b_p_flp);
|
||||||
case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
|
case PV_IMI: return (char_u *)&(curbuf->b_p_iminsert);
|
||||||
@ -11200,10 +11155,8 @@ buf_copy_options(buf_T *buf, int flags)
|
|||||||
buf->b_p_cink = vim_strsave(p_cink);
|
buf->b_p_cink = vim_strsave(p_cink);
|
||||||
buf->b_p_cino = vim_strsave(p_cino);
|
buf->b_p_cino = vim_strsave(p_cino);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't copy 'filetype', it must be detected */
|
/* Don't copy 'filetype', it must be detected */
|
||||||
buf->b_p_ft = empty_option;
|
buf->b_p_ft = empty_option;
|
||||||
#endif
|
|
||||||
buf->b_p_pi = p_pi;
|
buf->b_p_pi = p_pi;
|
||||||
#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT)
|
||||||
buf->b_p_cinw = vim_strsave(p_cinw);
|
buf->b_p_cinw = vim_strsave(p_cinw);
|
||||||
|
@ -477,9 +477,7 @@ EXTERN char_u *p_efm; /* 'errorformat' */
|
|||||||
EXTERN char_u *p_gefm; /* 'grepformat' */
|
EXTERN char_u *p_gefm; /* 'grepformat' */
|
||||||
EXTERN char_u *p_gp; /* 'grepprg' */
|
EXTERN char_u *p_gp; /* 'grepprg' */
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
EXTERN char_u *p_ei; /* 'eventignore' */
|
EXTERN char_u *p_ei; /* 'eventignore' */
|
||||||
#endif
|
|
||||||
EXTERN int p_ek; /* 'esckeys' */
|
EXTERN int p_ek; /* 'esckeys' */
|
||||||
EXTERN int p_exrc; /* 'exrc' */
|
EXTERN int p_exrc; /* 'exrc' */
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
@ -1046,9 +1044,7 @@ enum
|
|||||||
, BV_FF
|
, BV_FF
|
||||||
, BV_FLP
|
, BV_FLP
|
||||||
, BV_FO
|
, BV_FO
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
, BV_FT
|
, BV_FT
|
||||||
#endif
|
|
||||||
, BV_IMI
|
, BV_IMI
|
||||||
, BV_IMS
|
, BV_IMS
|
||||||
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
#if defined(FEAT_CINDENT) && defined(FEAT_EVAL)
|
||||||
|
@ -152,7 +152,6 @@ mch_inchar(
|
|||||||
*/
|
*/
|
||||||
if (WaitForChar(raw_in, p_ut * 1000L) == 0)
|
if (WaitForChar(raw_in, p_ut * 1000L) == 0)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (trigger_cursorhold() && maxlen >= 3)
|
if (trigger_cursorhold() && maxlen >= 3)
|
||||||
{
|
{
|
||||||
buf[0] = K_SPECIAL;
|
buf[0] = K_SPECIAL;
|
||||||
@ -160,7 +159,6 @@ mch_inchar(
|
|||||||
buf[2] = (int)KE_CURSORHOLD;
|
buf[2] = (int)KE_CURSORHOLD;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
before_blocking();
|
before_blocking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2163,7 +2163,6 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
(data->dwData == COPYDATA_RESULT ? 1 :
|
(data->dwData == COPYDATA_RESULT ? 1 :
|
||||||
2))) == FAIL)
|
2))) == FAIL)
|
||||||
vim_free(str);
|
vim_free(str);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
else if (data->dwData == COPYDATA_REPLY)
|
else if (data->dwData == COPYDATA_REPLY)
|
||||||
{
|
{
|
||||||
char_u winstr[30];
|
char_u winstr[30];
|
||||||
@ -2172,7 +2171,6 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||||||
apply_autocmds(EVENT_REMOTEREPLY, winstr, str,
|
apply_autocmds(EVENT_REMOTEREPLY, winstr, str,
|
||||||
TRUE, curbuf);
|
TRUE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +445,6 @@ mch_inchar(
|
|||||||
{
|
{
|
||||||
/* no character available within 'updatetime' */
|
/* no character available within 'updatetime' */
|
||||||
did_start_blocking = TRUE;
|
did_start_blocking = TRUE;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (trigger_cursorhold() && maxlen >= 3
|
if (trigger_cursorhold() && maxlen >= 3
|
||||||
&& !typebuf_changed(tb_change_cnt))
|
&& !typebuf_changed(tb_change_cnt))
|
||||||
{
|
{
|
||||||
@ -454,7 +453,6 @@ mch_inchar(
|
|||||||
buf[2] = (int)KE_CURSORHOLD;
|
buf[2] = (int)KE_CURSORHOLD;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* If there is no character available within 'updatetime'
|
* If there is no character available within 'updatetime'
|
||||||
* seconds flush all the swap files to disk.
|
* seconds flush all the swap files to disk.
|
||||||
@ -1133,16 +1131,15 @@ deathtrap SIGDEFARG(sigarg)
|
|||||||
/* Remember how often we have been called. */
|
/* Remember how often we have been called. */
|
||||||
++entered;
|
++entered;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Executing autocommands is likely to use more stack space than we have
|
/* Executing autocommands is likely to use more stack space than we have
|
||||||
* available in the signal stack. */
|
* available in the signal stack. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/* Set the v:dying variable. */
|
/* Set the v:dying variable. */
|
||||||
set_vim_var_nr(VV_DYING, (long)entered);
|
set_vim_var_nr(VV_DYING, (long)entered);
|
||||||
#endif
|
#endif
|
||||||
|
v_dying = entered;
|
||||||
|
|
||||||
#ifdef HAVE_STACK_LIMIT
|
#ifdef HAVE_STACK_LIMIT
|
||||||
/* Since we are now using the signal stack, need to reset the stack
|
/* Since we are now using the signal stack, need to reset the stack
|
||||||
|
@ -1787,7 +1787,6 @@ mch_inchar(
|
|||||||
*/
|
*/
|
||||||
if (!WaitForChar(p_ut, FALSE))
|
if (!WaitForChar(p_ut, FALSE))
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (trigger_cursorhold() && maxlen >= 3)
|
if (trigger_cursorhold() && maxlen >= 3)
|
||||||
{
|
{
|
||||||
buf[0] = K_SPECIAL;
|
buf[0] = K_SPECIAL;
|
||||||
@ -1795,7 +1794,6 @@ mch_inchar(
|
|||||||
buf[2] = (int)KE_CURSORHOLD;
|
buf[2] = (int)KE_CURSORHOLD;
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
before_blocking();
|
before_blocking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3626,13 +3626,10 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last)
|
|||||||
/* Set the 'filetype' to "qf" each time after filling the buffer.
|
/* Set the 'filetype' to "qf" each time after filling the buffer.
|
||||||
* This resembles reading a file into a buffer, it's more logical when
|
* This resembles reading a file into a buffer, it's more logical when
|
||||||
* using autocommands. */
|
* using autocommands. */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
++curbuf_lock;
|
++curbuf_lock;
|
||||||
#endif
|
|
||||||
set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL);
|
set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL);
|
||||||
curbuf->b_p_ma = FALSE;
|
curbuf->b_p_ma = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
keep_filetype = TRUE; /* don't detect 'filetype' */
|
keep_filetype = TRUE; /* don't detect 'filetype' */
|
||||||
apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL,
|
apply_autocmds(EVENT_BUFREADPOST, (char_u *)"quickfix", NULL,
|
||||||
FALSE, curbuf);
|
FALSE, curbuf);
|
||||||
@ -3640,7 +3637,7 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last)
|
|||||||
FALSE, curbuf);
|
FALSE, curbuf);
|
||||||
keep_filetype = FALSE;
|
keep_filetype = FALSE;
|
||||||
--curbuf_lock;
|
--curbuf_lock;
|
||||||
#endif
|
|
||||||
/* make sure it will be redrawn */
|
/* make sure it will be redrawn */
|
||||||
redraw_curbuf_later(NOT_VALID);
|
redraw_curbuf_later(NOT_VALID);
|
||||||
}
|
}
|
||||||
@ -3682,7 +3679,6 @@ ex_make(exarg_T *eap)
|
|||||||
win_T *wp = NULL;
|
win_T *wp = NULL;
|
||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
int res;
|
int res;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
|
|
||||||
/* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */
|
/* Redirect ":grep" to ":vimgrep" if 'grepprg' is "internal". */
|
||||||
@ -3705,12 +3701,11 @@ ex_make(exarg_T *eap)
|
|||||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||||
#endif
|
#endif
|
||||||
@ -3766,7 +3761,6 @@ ex_make(exarg_T *eap)
|
|||||||
qi = GET_LOC_LIST(wp);
|
qi = GET_LOC_LIST(wp);
|
||||||
if (res >= 0 && qi != NULL)
|
if (res >= 0 && qi != NULL)
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
{
|
{
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
@ -3776,7 +3770,6 @@ ex_make(exarg_T *eap)
|
|||||||
else
|
else
|
||||||
res = 0;
|
res = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (res > 0 && !eap->forceit)
|
if (res > 0 && !eap->forceit)
|
||||||
qf_jump(qi, 0, 0, FALSE); /* display first error */
|
qf_jump(qi, 0, 0, FALSE); /* display first error */
|
||||||
|
|
||||||
@ -4105,13 +4098,10 @@ ex_cfile(exarg_T *eap)
|
|||||||
char_u *enc = NULL;
|
char_u *enc = NULL;
|
||||||
win_T *wp = NULL;
|
win_T *wp = NULL;
|
||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
int save_qfid;
|
int save_qfid;
|
||||||
#endif
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
case CMD_cfile: au_name = (char_u *)"cfile"; break;
|
case CMD_cfile: au_name = (char_u *)"cfile"; break;
|
||||||
@ -4124,7 +4114,6 @@ ex_cfile(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;
|
||||||
#endif
|
#endif
|
||||||
@ -4164,7 +4153,6 @@ ex_cfile(exarg_T *eap)
|
|||||||
qi = GET_LOC_LIST(wp);
|
qi = GET_LOC_LIST(wp);
|
||||||
if (res >= 0 && qi != NULL)
|
if (res >= 0 && qi != NULL)
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (qi != NULL)
|
if (qi != NULL)
|
||||||
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
|
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
@ -4174,7 +4162,6 @@ ex_cfile(exarg_T *eap)
|
|||||||
* is still valid. */
|
* is still valid. */
|
||||||
if (qi != NULL && !qflist_valid(wp, save_qfid))
|
if (qi != NULL && !qflist_valid(wp, save_qfid))
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
|
if (res > 0 && (eap->cmdidx == CMD_cfile || eap->cmdidx == CMD_lfile))
|
||||||
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
||||||
}
|
}
|
||||||
@ -4198,11 +4185,9 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
int fi;
|
int fi;
|
||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
int loclist_cmd = FALSE;
|
int loclist_cmd = FALSE;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int_u save_qfid;
|
int_u save_qfid;
|
||||||
qfline_T *cur_qf_start;
|
qfline_T *cur_qf_start;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
#endif
|
|
||||||
long lnum;
|
long lnum;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
int duplicate_name = FALSE;
|
int duplicate_name = FALSE;
|
||||||
@ -4212,7 +4197,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
buf_T *first_match_buf = NULL;
|
buf_T *first_match_buf = NULL;
|
||||||
time_t seconds = 0;
|
time_t seconds = 0;
|
||||||
int save_mls;
|
int save_mls;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
char_u *save_ei = NULL;
|
char_u *save_ei = NULL;
|
||||||
#endif
|
#endif
|
||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
@ -4222,7 +4207,6 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
char_u *dirname_start = NULL;
|
char_u *dirname_start = NULL;
|
||||||
char_u *dirname_now = NULL;
|
char_u *dirname_now = NULL;
|
||||||
char_u *target_dir = NULL;
|
char_u *target_dir = NULL;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
@ -4240,12 +4224,11 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_lgrep
|
if (eap->cmdidx == CMD_lgrep
|
||||||
|| eap->cmdidx == CMD_lvimgrep
|
|| eap->cmdidx == CMD_lvimgrep
|
||||||
@ -4325,12 +4308,10 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
* ":lcd %:p:h" changes the meaning of short path names. */
|
* ":lcd %:p:h" changes the meaning of short path names. */
|
||||||
mch_dirname(dirname_start, MAXPATHL);
|
mch_dirname(dirname_start, MAXPATHL);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Remember the current values of the quickfix list and qf_start, so that
|
/* Remember the current values of the quickfix list and qf_start, so that
|
||||||
* we can check for autocommands changing the current quickfix list. */
|
* we can check for autocommands changing the current quickfix list. */
|
||||||
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
|
save_qfid = qi->qf_lists[qi->qf_curlist].qf_id;
|
||||||
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
||||||
#endif
|
|
||||||
|
|
||||||
seconds = (time_t)0;
|
seconds = (time_t)0;
|
||||||
for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
|
for (fi = 0; fi < fcount && !got_int && tomatch > 0; ++fi)
|
||||||
@ -4365,7 +4346,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
using_dummy = TRUE;
|
using_dummy = TRUE;
|
||||||
redraw_for_dummy = TRUE;
|
redraw_for_dummy = TRUE;
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
/* Don't do Filetype autocommands to avoid loading syntax and
|
/* Don't do Filetype autocommands to avoid loading syntax and
|
||||||
* indent scripts, a great speed improvement. */
|
* indent scripts, a great speed improvement. */
|
||||||
save_ei = au_event_disable(",Filetype");
|
save_ei = au_event_disable(",Filetype");
|
||||||
@ -4379,7 +4360,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
buf = load_dummy_buffer(fname, dirname_start, dirname_now);
|
buf = load_dummy_buffer(fname, dirname_start, dirname_now);
|
||||||
|
|
||||||
p_mls = save_mls;
|
p_mls = save_mls;
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
au_event_restore(save_ei);
|
au_event_restore(save_ei);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -4387,7 +4368,6 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
/* Use existing, loaded buffer. */
|
/* Use existing, loaded buffer. */
|
||||||
using_dummy = FALSE;
|
using_dummy = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (loclist_cmd)
|
if (loclist_cmd)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -4419,7 +4399,6 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
{
|
{
|
||||||
@ -4475,9 +4454,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
if (got_int)
|
if (got_int)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
cur_qf_start = qi->qf_lists[qi->qf_curlist].qf_start;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (using_dummy)
|
if (using_dummy)
|
||||||
{
|
{
|
||||||
@ -4532,7 +4509,7 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
* need to be done (again). But not the window-local
|
* need to be done (again). But not the window-local
|
||||||
* options! */
|
* options! */
|
||||||
aucmd_prepbuf(&aco, buf);
|
aucmd_prepbuf(&aco, buf);
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
|
#if defined(FEAT_SYN_HL)
|
||||||
apply_autocmds(EVENT_FILETYPE, buf->b_p_ft,
|
apply_autocmds(EVENT_FILETYPE, buf->b_p_ft,
|
||||||
buf->b_fname, TRUE, buf);
|
buf->b_fname, TRUE, buf);
|
||||||
#endif
|
#endif
|
||||||
@ -4552,7 +4529,6 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
|
|
||||||
qf_update_buffer(qi, NULL);
|
qf_update_buffer(qi, NULL);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
@ -4563,7 +4539,6 @@ ex_vimgrep(exarg_T *eap)
|
|||||||
wp = loclist_cmd ? curwin : NULL;
|
wp = loclist_cmd ? curwin : NULL;
|
||||||
if (!qflist_valid(wp, save_qfid))
|
if (!qflist_valid(wp, save_qfid))
|
||||||
goto theend;
|
goto theend;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Jump to first match. */
|
/* Jump to first match. */
|
||||||
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
|
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
|
||||||
@ -4748,7 +4723,7 @@ wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
|
|||||||
{
|
{
|
||||||
if (curbuf != buf) /* safety check */
|
if (curbuf != buf) /* safety check */
|
||||||
{
|
{
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
cleanup_T cs;
|
cleanup_T cs;
|
||||||
|
|
||||||
/* Reset the error/interrupt/exception state here so that aborting()
|
/* Reset the error/interrupt/exception state here so that aborting()
|
||||||
@ -4759,7 +4734,7 @@ wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
|
|||||||
|
|
||||||
wipe_buffer(buf, FALSE);
|
wipe_buffer(buf, FALSE);
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
/* Restore the error/interrupt/exception state if not discarded by a
|
/* Restore the error/interrupt/exception state if not discarded by a
|
||||||
* new aborting error, interrupt, or uncaught exception. */
|
* new aborting error, interrupt, or uncaught exception. */
|
||||||
leave_cleanup(&cs);
|
leave_cleanup(&cs);
|
||||||
@ -5598,12 +5573,9 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
buf_T *buf = NULL;
|
buf_T *buf = NULL;
|
||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
#endif
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break;
|
case CMD_cbuffer: au_name = (char_u *)"cbuffer"; break;
|
||||||
@ -5617,12 +5589,11 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Must come after autocommands. */
|
/* Must come after autocommands. */
|
||||||
if (eap->cmdidx == CMD_lbuffer
|
if (eap->cmdidx == CMD_lbuffer
|
||||||
@ -5670,11 +5641,9 @@ ex_cbuffer(exarg_T *eap)
|
|||||||
qf_title, NULL);
|
qf_title, NULL);
|
||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
#endif
|
|
||||||
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
|
if (res > 0 && (eap->cmdidx == CMD_cbuffer ||
|
||||||
eap->cmdidx == CMD_lbuffer))
|
eap->cmdidx == CMD_lbuffer))
|
||||||
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
||||||
@ -5692,12 +5661,9 @@ ex_cexpr(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
typval_T *tv;
|
typval_T *tv;
|
||||||
qf_info_T *qi = &ql_info;
|
qf_info_T *qi = &ql_info;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
#endif
|
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
case CMD_cexpr: au_name = (char_u *)"cexpr"; break;
|
case CMD_cexpr: au_name = (char_u *)"cexpr"; break;
|
||||||
@ -5711,12 +5677,11 @@ ex_cexpr(exarg_T *eap)
|
|||||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (eap->cmdidx == CMD_lexpr
|
if (eap->cmdidx == CMD_lexpr
|
||||||
|| eap->cmdidx == CMD_lgetexpr
|
|| eap->cmdidx == CMD_lgetexpr
|
||||||
@ -5742,11 +5707,9 @@ ex_cexpr(exarg_T *eap)
|
|||||||
NULL);
|
NULL);
|
||||||
if (res >= 0)
|
if (res >= 0)
|
||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf);
|
curbuf->b_fname, TRUE, curbuf);
|
||||||
#endif
|
|
||||||
if (res > 0 && (eap->cmdidx == CMD_cexpr ||
|
if (res > 0 && (eap->cmdidx == CMD_cexpr ||
|
||||||
eap->cmdidx == CMD_lexpr))
|
eap->cmdidx == CMD_lexpr))
|
||||||
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
qf_jump(qi, 0, 0, eap->forceit); /* display first error */
|
||||||
@ -5779,16 +5742,13 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
qf_info_T *save_qi;
|
qf_info_T *save_qi;
|
||||||
int new_qi = FALSE;
|
int new_qi = FALSE;
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *au_name = NULL;
|
char_u *au_name = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_MULTI_LANG
|
#ifdef FEAT_MULTI_LANG
|
||||||
/* Check for a specified language */
|
/* Check for a specified language */
|
||||||
lang = check_help_lang(eap->arg);
|
lang = check_help_lang(eap->arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
switch (eap->cmdidx)
|
switch (eap->cmdidx)
|
||||||
{
|
{
|
||||||
case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break;
|
case CMD_helpgrep: au_name = (char_u *)"helpgrep"; break;
|
||||||
@ -5798,12 +5758,11 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
if (au_name != NULL && apply_autocmds(EVENT_QUICKFIXCMDPRE, au_name,
|
||||||
curbuf->b_fname, TRUE, curbuf))
|
curbuf->b_fname, TRUE, curbuf))
|
||||||
{
|
{
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
/* Make 'cpoptions' empty, the 'l' flag should not be used here. */
|
||||||
save_cpo = p_cpo;
|
save_cpo = p_cpo;
|
||||||
@ -5965,7 +5924,6 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
qf_list_changed(qi, qi->qf_curlist);
|
qf_list_changed(qi, qi->qf_curlist);
|
||||||
qf_update_buffer(qi, NULL);
|
qf_update_buffer(qi, NULL);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (au_name != NULL)
|
if (au_name != NULL)
|
||||||
{
|
{
|
||||||
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
apply_autocmds(EVENT_QUICKFIXCMDPOST, au_name,
|
||||||
@ -5974,7 +5932,6 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
/* autocommands made "qi" invalid */
|
/* autocommands made "qi" invalid */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Jump to first match. */
|
/* Jump to first match. */
|
||||||
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
|
if (qi->qf_lists[qi->qf_curlist].qf_count > 0)
|
||||||
|
@ -8767,11 +8767,9 @@ screenalloc(int doclear)
|
|||||||
tabpage_T *tp;
|
tabpage_T *tp;
|
||||||
static int entered = FALSE; /* avoid recursiveness */
|
static int entered = FALSE; /* avoid recursiveness */
|
||||||
static int done_outofmem_msg = FALSE; /* did outofmem message */
|
static int done_outofmem_msg = FALSE; /* did outofmem message */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int retry_count = 0;
|
int retry_count = 0;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Allocation of the screen buffers is done only when the size changes and
|
* Allocation of the screen buffers is done only when the size changes and
|
||||||
* when Rows and Columns have been set and we have started doing full
|
* when Rows and Columns have been set and we have started doing full
|
||||||
@ -8823,10 +8821,8 @@ retry:
|
|||||||
*/
|
*/
|
||||||
FOR_ALL_TAB_WINDOWS(tp, wp)
|
FOR_ALL_TAB_WINDOWS(tp, wp)
|
||||||
win_free_lsize(wp);
|
win_free_lsize(wp);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (aucmd_win != NULL)
|
if (aucmd_win != NULL)
|
||||||
win_free_lsize(aucmd_win);
|
win_free_lsize(aucmd_win);
|
||||||
#endif
|
|
||||||
|
|
||||||
new_ScreenLines = (schar_T *)lalloc((long_u)(
|
new_ScreenLines = (schar_T *)lalloc((long_u)(
|
||||||
(Rows + 1) * Columns * sizeof(schar_T)), FALSE);
|
(Rows + 1) * Columns * sizeof(schar_T)), FALSE);
|
||||||
@ -8859,11 +8855,9 @@ retry:
|
|||||||
goto give_up;
|
goto give_up;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (aucmd_win != NULL && aucmd_win->w_lines == NULL
|
if (aucmd_win != NULL && aucmd_win->w_lines == NULL
|
||||||
&& win_alloc_lines(aucmd_win) == FAIL)
|
&& win_alloc_lines(aucmd_win) == FAIL)
|
||||||
outofmem = TRUE;
|
outofmem = TRUE;
|
||||||
#endif
|
|
||||||
give_up:
|
give_up:
|
||||||
|
|
||||||
#ifdef FEAT_MBYTE
|
#ifdef FEAT_MBYTE
|
||||||
@ -9032,7 +9026,6 @@ give_up:
|
|||||||
entered = FALSE;
|
entered = FALSE;
|
||||||
--RedrawingDisabled;
|
--RedrawingDisabled;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Do not apply autocommands more than 3 times to avoid an endless loop
|
* Do not apply autocommands more than 3 times to avoid an endless loop
|
||||||
* in case applying autocommands always changes Rows or Columns.
|
* in case applying autocommands always changes Rows or Columns.
|
||||||
@ -9044,7 +9037,6 @@ give_up:
|
|||||||
* jump back to check if we need to allocate the screen again. */
|
* jump back to check if we need to allocate the screen again. */
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
16
src/search.c
16
src/search.c
@ -97,10 +97,8 @@ static char_u lastc_bytes[MB_MAXBYTES + 1];
|
|||||||
static int lastc_bytelen = 1; /* >1 for multi-byte char */
|
static int lastc_bytelen = 1; /* >1 for multi-byte char */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
|
|
||||||
/* copy of spats[], for keeping the search patterns while executing autocmds */
|
/* copy of spats[], for keeping the search patterns while executing autocmds */
|
||||||
static struct spat saved_spats[2];
|
static struct spat saved_spats[2];
|
||||||
#endif
|
|
||||||
# ifdef FEAT_SEARCH_EXTRA
|
# ifdef FEAT_SEARCH_EXTRA
|
||||||
/* copy of spats[RE_SEARCH], for keeping the search patterns while incremental
|
/* copy of spats[RE_SEARCH], for keeping the search patterns while incremental
|
||||||
* searching */
|
* searching */
|
||||||
@ -300,7 +298,6 @@ save_re_pat(int idx, char_u *pat, int magic)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(FEAT_EVAL) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Save the search patterns, so they can be restored later.
|
* Save the search patterns, so they can be restored later.
|
||||||
* Used before/after executing autocommands and user functions.
|
* Used before/after executing autocommands and user functions.
|
||||||
@ -318,10 +315,10 @@ save_search_patterns(void)
|
|||||||
saved_spats[1] = spats[1];
|
saved_spats[1] = spats[1];
|
||||||
if (spats[1].pat != NULL)
|
if (spats[1].pat != NULL)
|
||||||
saved_spats[1].pat = vim_strsave(spats[1].pat);
|
saved_spats[1].pat = vim_strsave(spats[1].pat);
|
||||||
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
saved_last_idx = last_idx;
|
saved_last_idx = last_idx;
|
||||||
# ifdef FEAT_SEARCH_EXTRA
|
|
||||||
saved_no_hlsearch = no_hlsearch;
|
saved_no_hlsearch = no_hlsearch;
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,18 +329,17 @@ restore_search_patterns(void)
|
|||||||
{
|
{
|
||||||
vim_free(spats[0].pat);
|
vim_free(spats[0].pat);
|
||||||
spats[0] = saved_spats[0];
|
spats[0] = saved_spats[0];
|
||||||
# if defined(FEAT_EVAL)
|
#if defined(FEAT_EVAL)
|
||||||
set_vv_searchforward();
|
set_vv_searchforward();
|
||||||
# endif
|
#endif
|
||||||
vim_free(spats[1].pat);
|
vim_free(spats[1].pat);
|
||||||
spats[1] = saved_spats[1];
|
spats[1] = saved_spats[1];
|
||||||
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
last_idx = saved_last_idx;
|
last_idx = saved_last_idx;
|
||||||
# ifdef FEAT_SEARCH_EXTRA
|
|
||||||
SET_NO_HLSEARCH(saved_no_hlsearch);
|
SET_NO_HLSEARCH(saved_no_hlsearch);
|
||||||
# endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(EXITFREE) || defined(PROTO)
|
#if defined(EXITFREE) || defined(PROTO)
|
||||||
void
|
void
|
||||||
|
12
src/spell.c
12
src/spell.c
@ -1849,9 +1849,7 @@ spell_load_lang(char_u *lang)
|
|||||||
char_u fname_enc[85];
|
char_u fname_enc[85];
|
||||||
int r;
|
int r;
|
||||||
spelload_T sl;
|
spelload_T sl;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int round;
|
int round;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Copy the language name to pass it to spell_load_cb() as a cookie.
|
/* Copy the language name to pass it to spell_load_cb() as a cookie.
|
||||||
* It's truncated when an error is detected. */
|
* It's truncated when an error is detected. */
|
||||||
@ -1859,11 +1857,9 @@ spell_load_lang(char_u *lang)
|
|||||||
sl.sl_slang = NULL;
|
sl.sl_slang = NULL;
|
||||||
sl.sl_nobreak = FALSE;
|
sl.sl_nobreak = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* We may retry when no spell file is found for the language, an
|
/* We may retry when no spell file is found for the language, an
|
||||||
* autocommand may load it then. */
|
* autocommand may load it then. */
|
||||||
for (round = 1; round <= 2; ++round)
|
for (round = 1; round <= 2; ++round)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Find the first spell file for "lang" in 'runtimepath' and load it.
|
* Find the first spell file for "lang" in 'runtimepath' and load it.
|
||||||
@ -1889,17 +1885,13 @@ spell_load_lang(char_u *lang)
|
|||||||
lang);
|
lang);
|
||||||
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
|
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (r == FAIL && *sl.sl_lang != NUL && round == 1
|
if (r == FAIL && *sl.sl_lang != NUL && round == 1
|
||||||
&& apply_autocmds(EVENT_SPELLFILEMISSING, lang,
|
&& apply_autocmds(EVENT_SPELLFILEMISSING, lang,
|
||||||
curbuf->b_fname, FALSE, curbuf))
|
curbuf->b_fname, FALSE, curbuf))
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r == FAIL)
|
if (r == FAIL)
|
||||||
@ -2348,11 +2340,9 @@ did_set_spelllang(win_T *wp)
|
|||||||
static int recursive = FALSE;
|
static int recursive = FALSE;
|
||||||
char_u *ret_msg = NULL;
|
char_u *ret_msg = NULL;
|
||||||
char_u *spl_copy;
|
char_u *spl_copy;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, wp->w_buffer);
|
set_bufref(&bufref, wp->w_buffer);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We don't want to do this recursively. May happen when a language is
|
/* We don't want to do this recursively. May happen when a language is
|
||||||
* not available and the SpellFileMissing autocommand opens a new buffer
|
* not available and the SpellFileMissing autocommand opens a new buffer
|
||||||
@ -2449,7 +2439,6 @@ did_set_spelllang(win_T *wp)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
spell_load_lang(lang);
|
spell_load_lang(lang);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* SpellFileMissing autocommands may do anything, including
|
/* SpellFileMissing autocommands may do anything, including
|
||||||
* destroying the buffer we are using... */
|
* destroying the buffer we are using... */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
@ -2457,7 +2446,6 @@ did_set_spelllang(win_T *wp)
|
|||||||
ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer");
|
ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer");
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,9 +586,7 @@ typedef struct
|
|||||||
int lockmarks; /* TRUE when ":lockmarks" was used */
|
int lockmarks; /* TRUE when ":lockmarks" was used */
|
||||||
int keeppatterns; /* TRUE when ":keeppatterns" was used */
|
int keeppatterns; /* TRUE when ":keeppatterns" was used */
|
||||||
int noswapfile; /* TRUE when ":noswapfile" was used */
|
int noswapfile; /* TRUE when ":noswapfile" was used */
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
char_u *save_ei; /* saved value of 'eventignore' */
|
char_u *save_ei; /* saved value of 'eventignore' */
|
||||||
# endif
|
|
||||||
regmatch_T filter_regmatch; /* set by :filter /pat/ */
|
regmatch_T filter_regmatch; /* set by :filter /pat/ */
|
||||||
int filter_force; /* set for :filter! */
|
int filter_force; /* set for :filter! */
|
||||||
} cmdmod_T;
|
} cmdmod_T;
|
||||||
@ -1946,10 +1944,8 @@ struct file_buffer
|
|||||||
int b_nwindows; /* nr of windows open on this buffer */
|
int b_nwindows; /* nr of windows open on this buffer */
|
||||||
|
|
||||||
int b_flags; /* various BF_ flags */
|
int b_flags; /* various BF_ flags */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int b_locked; /* Buffer is being closed or referenced, don't
|
int b_locked; /* Buffer is being closed or referenced, don't
|
||||||
let autocommands wipe it out. */
|
let autocommands wipe it out. */
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* b_ffname has the full path of the file (NULL for no name).
|
* b_ffname has the full path of the file (NULL for no name).
|
||||||
@ -1986,13 +1982,11 @@ struct file_buffer
|
|||||||
incremented for each change, also for undo */
|
incremented for each change, also for undo */
|
||||||
#define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number)
|
#define CHANGEDTICK(buf) ((buf)->b_ct_di.di_tv.vval.v_number)
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or
|
varnumber_T b_last_changedtick; /* b:changedtick when TextChanged or
|
||||||
TextChangedI was last triggered. */
|
TextChangedI was last triggered. */
|
||||||
# ifdef FEAT_INS_EXPAND
|
#ifdef FEAT_INS_EXPAND
|
||||||
varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was
|
varnumber_T b_last_changedtick_pum; /* b:changedtick when TextChangedP was
|
||||||
last triggered. */
|
last triggered. */
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int b_saving; /* Set to TRUE if we are in the middle of
|
int b_saving; /* Set to TRUE if we are in the middle of
|
||||||
@ -2171,9 +2165,7 @@ struct file_buffer
|
|||||||
char_u *b_p_fenc; /* 'fileencoding' */
|
char_u *b_p_fenc; /* 'fileencoding' */
|
||||||
#endif
|
#endif
|
||||||
char_u *b_p_ff; /* 'fileformat' */
|
char_u *b_p_ff; /* 'fileformat' */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char_u *b_p_ft; /* 'filetype' */
|
char_u *b_p_ft; /* 'filetype' */
|
||||||
#endif
|
|
||||||
char_u *b_p_fo; /* 'formatoptions' */
|
char_u *b_p_fo; /* 'formatoptions' */
|
||||||
char_u *b_p_flp; /* 'formatlistpat' */
|
char_u *b_p_flp; /* 'formatlistpat' */
|
||||||
int b_p_inf; /* 'infercase' */
|
int b_p_inf; /* 'infercase' */
|
||||||
@ -2448,12 +2440,8 @@ struct diffblock_S
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SNAP_HELP_IDX 0
|
#define SNAP_HELP_IDX 0
|
||||||
#ifdef FEAT_AUTOCMD
|
#define SNAP_AUCMD_IDX 1
|
||||||
# define SNAP_AUCMD_IDX 1
|
#define SNAP_COUNT 2
|
||||||
# define SNAP_COUNT 2
|
|
||||||
#else
|
|
||||||
# define SNAP_COUNT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tab pages point to the top frame of each tab page.
|
* Tab pages point to the top frame of each tab page.
|
||||||
@ -2642,10 +2630,8 @@ struct window_S
|
|||||||
|
|
||||||
win_T *w_prev; /* link to previous window */
|
win_T *w_prev; /* link to previous window */
|
||||||
win_T *w_next; /* link to next window */
|
win_T *w_next; /* link to next window */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int w_closing; /* window is being closed, don't let
|
int w_closing; /* window is being closed, don't let
|
||||||
autocommands close it too. */
|
autocommands close it too. */
|
||||||
#endif
|
|
||||||
|
|
||||||
frame_T *w_frame; /* frame containing this window */
|
frame_T *w_frame; /* frame containing this window */
|
||||||
|
|
||||||
@ -2676,10 +2662,8 @@ struct window_S
|
|||||||
*/
|
*/
|
||||||
linenr_T w_topline; /* buffer line number of the line at the
|
linenr_T w_topline; /* buffer line number of the line at the
|
||||||
top of the window */
|
top of the window */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
char w_topline_was_set; /* flag set to TRUE when topline is set,
|
char w_topline_was_set; /* flag set to TRUE when topline is set,
|
||||||
e.g. by winrestview() */
|
e.g. by winrestview() */
|
||||||
#endif
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
int w_topfill; /* number of filler lines above w_topline */
|
int w_topfill; /* number of filler lines above w_topline */
|
||||||
int w_old_topfill; /* w_topfill at last redraw */
|
int w_old_topfill; /* w_topfill at last redraw */
|
||||||
@ -2973,10 +2957,8 @@ typedef struct oparg_S
|
|||||||
int block_mode; /* current operator is Visual block mode */
|
int block_mode; /* current operator is Visual block mode */
|
||||||
colnr_T start_vcol; /* start col for block mode operator */
|
colnr_T start_vcol; /* start col for block mode operator */
|
||||||
colnr_T end_vcol; /* end col for block mode operator */
|
colnr_T end_vcol; /* end col for block mode operator */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */
|
long prev_opcount; /* ca.opcount saved for K_CURSORHOLD */
|
||||||
long prev_count0; /* ca.count0 saved for K_CURSORHOLD */
|
long prev_count0; /* ca.count0 saved for K_CURSORHOLD */
|
||||||
#endif
|
|
||||||
} oparg_T;
|
} oparg_T;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3160,18 +3142,16 @@ typedef int vimmenu_T;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Struct to save values in before executing autocommands for a buffer that is
|
* Struct to save values in before executing autocommands for a buffer that is
|
||||||
* not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered.
|
* not the current buffer.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
buf_T *save_curbuf; /* saved curbuf */
|
buf_T *save_curbuf; /* saved curbuf */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int use_aucmd_win; /* using aucmd_win */
|
int use_aucmd_win; /* using aucmd_win */
|
||||||
win_T *save_curwin; /* saved curwin */
|
win_T *save_curwin; /* saved curwin */
|
||||||
win_T *new_curwin; /* new curwin */
|
win_T *new_curwin; /* new curwin */
|
||||||
bufref_T new_curbuf; /* new curbuf */
|
bufref_T new_curbuf; /* new curbuf */
|
||||||
char_u *globaldir; /* saved value of globaldir */
|
char_u *globaldir; /* saved value of globaldir */
|
||||||
#endif
|
|
||||||
} aco_save_T;
|
} aco_save_T;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6420,11 +6420,9 @@ ex_ownsyntax(exarg_T *eap)
|
|||||||
if (old_value != NULL)
|
if (old_value != NULL)
|
||||||
old_value = vim_strsave(old_value);
|
old_value = vim_strsave(old_value);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Apply the "syntax" autocommand event, this finds and loads the syntax
|
/* Apply the "syntax" autocommand event, this finds and loads the syntax
|
||||||
* file. */
|
* file. */
|
||||||
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
|
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* move value of b:current_syntax to w:current_syntax */
|
/* move value of b:current_syntax to w:current_syntax */
|
||||||
new_value = get_var_value((char_u *)"b:current_syntax");
|
new_value = get_var_value((char_u *)"b:current_syntax");
|
||||||
@ -6995,10 +6993,8 @@ static char *(highlight_init_light[]) = {
|
|||||||
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey",
|
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey",
|
||||||
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"),
|
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"),
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
CENT("MatchParen term=reverse ctermbg=Cyan",
|
CENT("MatchParen term=reverse ctermbg=Cyan",
|
||||||
"MatchParen term=reverse ctermbg=Cyan guibg=Cyan"),
|
"MatchParen term=reverse ctermbg=Cyan guibg=Cyan"),
|
||||||
#endif
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
"Normal gui=NONE",
|
"Normal gui=NONE",
|
||||||
#endif
|
#endif
|
||||||
@ -7089,10 +7085,8 @@ static char *(highlight_init_dark[]) = {
|
|||||||
CENT("ColorColumn term=reverse ctermbg=DarkRed",
|
CENT("ColorColumn term=reverse ctermbg=DarkRed",
|
||||||
"ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"),
|
"ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"),
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
CENT("MatchParen term=reverse ctermbg=DarkCyan",
|
CENT("MatchParen term=reverse ctermbg=DarkCyan",
|
||||||
"MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"),
|
"MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"),
|
||||||
#endif
|
|
||||||
#ifdef FEAT_CONCEAL
|
#ifdef FEAT_CONCEAL
|
||||||
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey",
|
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey",
|
||||||
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"),
|
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"),
|
||||||
@ -7233,9 +7227,7 @@ load_colors(char_u *name)
|
|||||||
sprintf((char *)buf, "colors/%s.vim", name);
|
sprintf((char *)buf, "colors/%s.vim", name);
|
||||||
retval = source_runtime(buf, DIP_START + DIP_OPT);
|
retval = source_runtime(buf, DIP_START + DIP_OPT);
|
||||||
vim_free(buf);
|
vim_free(buf);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
|
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
recursive = FALSE;
|
recursive = FALSE;
|
||||||
|
|
||||||
|
10
src/tag.c
10
src/tag.c
@ -1017,7 +1017,7 @@ do_tag(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
/* Let the SwapExists event know what tag we are jumping to. */
|
/* Let the SwapExists event know what tag we are jumping to. */
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name);
|
vim_snprintf((char *)IObuff, IOSIZE, ":ta %s\r", name);
|
||||||
set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1);
|
set_vim_var_string(VV_SWAPCOMMAND, IObuff, -1);
|
||||||
@ -1028,7 +1028,7 @@ do_tag(
|
|||||||
*/
|
*/
|
||||||
i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE);
|
i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_EVAL)
|
||||||
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3174,11 +3174,7 @@ jumpto_tag(
|
|||||||
* file. Also accept a file name for which there is a matching BufReadCmd
|
* file. Also accept a file name for which there is a matching BufReadCmd
|
||||||
* autocommand event (e.g., http://sys/file).
|
* autocommand event (e.g., http://sys/file).
|
||||||
*/
|
*/
|
||||||
if (mch_getperm(fname) < 0
|
if (mch_getperm(fname) < 0 && !has_autocmd(EVENT_BUFREADCMD, fname, NULL))
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !has_autocmd(EVENT_BUFREADCMD, fname, NULL)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
retval = NOTAGFILE;
|
retval = NOTAGFILE;
|
||||||
vim_free(nofile_fname);
|
vim_free(nofile_fname);
|
||||||
|
@ -1985,7 +1985,6 @@ set_termname(char_u *term)
|
|||||||
scroll_region_reset(); /* In case Rows changed */
|
scroll_region_reset(); /* In case Rows changed */
|
||||||
check_map_keycodes(); /* check mappings for terminal codes used */
|
check_map_keycodes(); /* check mappings for terminal codes used */
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
{
|
{
|
||||||
bufref_T old_curbuf;
|
bufref_T old_curbuf;
|
||||||
|
|
||||||
@ -2003,7 +2002,6 @@ set_termname(char_u *term)
|
|||||||
if (bufref_valid(&old_curbuf))
|
if (bufref_valid(&old_curbuf))
|
||||||
curbuf = old_curbuf.br_buf;
|
curbuf = old_curbuf.br_buf;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_TERMRESPONSE
|
#ifdef FEAT_TERMRESPONSE
|
||||||
@ -4515,9 +4513,7 @@ check_termcode(
|
|||||||
|
|
||||||
LOG_TR("Received U7 status");
|
LOG_TR("Received U7 status");
|
||||||
u7_status = STATUS_GOT;
|
u7_status = STATUS_GOT;
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
# endif
|
|
||||||
if (col == 2)
|
if (col == 2)
|
||||||
aw = "single";
|
aw = "single";
|
||||||
else if (col == 3)
|
else if (col == 3)
|
||||||
@ -4560,9 +4556,7 @@ check_termcode(
|
|||||||
|
|
||||||
LOG_TR("Received CRV response");
|
LOG_TR("Received CRV response");
|
||||||
crv_status = STATUS_GOT;
|
crv_status = STATUS_GOT;
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
did_cursorhold = TRUE;
|
did_cursorhold = TRUE;
|
||||||
# endif
|
|
||||||
|
|
||||||
/* If this code starts with CSI, you can bet that the
|
/* If this code starts with CSI, you can bet that the
|
||||||
* terminal uses 8-bit codes. */
|
* terminal uses 8-bit codes. */
|
||||||
@ -4702,10 +4696,8 @@ check_termcode(
|
|||||||
# ifdef FEAT_EVAL
|
# ifdef FEAT_EVAL
|
||||||
set_vim_var_string(VV_TERMRESPONSE, tp, slen);
|
set_vim_var_string(VV_TERMRESPONSE, tp, slen);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_TERMRESPONSE,
|
apply_autocmds(EVENT_TERMRESPONSE,
|
||||||
NULL, NULL, FALSE, curbuf);
|
NULL, NULL, FALSE, curbuf);
|
||||||
# endif
|
|
||||||
key_name[0] = (int)KS_EXTRA;
|
key_name[0] = (int)KS_EXTRA;
|
||||||
key_name[1] = (int)KE_IGNORE;
|
key_name[1] = (int)KE_IGNORE;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,10 @@
|
|||||||
* in tl_scrollback are no longer used.
|
* in tl_scrollback are no longer used.
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
|
* - What to store in a session file? Shell at the prompt would be OK to
|
||||||
|
* restore, but others may not. Open the window and let the user start the
|
||||||
|
* command? Also see #2650.
|
||||||
|
* - Adding WinBar to terminal window doesn't display, text isn't shifted down.
|
||||||
* - When using 'termguicolors' still use the 16 ANSI colors as-is. Helps for
|
* - When using 'termguicolors' still use the 16 ANSI colors as-is. Helps for
|
||||||
* a job that uses 16 colors while Vim is using > 256.
|
* a job that uses 16 colors while Vim is using > 256.
|
||||||
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
|
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
|
||||||
@ -46,24 +50,20 @@
|
|||||||
* - after resizing windows overlap. (Boris Staletic, #2164)
|
* - after resizing windows overlap. (Boris Staletic, #2164)
|
||||||
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
|
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
|
||||||
* is disabled.
|
* is disabled.
|
||||||
|
* - if the job in the terminal does not support the mouse, we can use the
|
||||||
|
* mouse in the Terminal window for copy/paste and scrolling.
|
||||||
* - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
|
* - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
|
||||||
* - What to store in a session file? Shell at the prompt would be OK to
|
|
||||||
* restore, but others may not. Open the window and let the user start the
|
|
||||||
* command? Also see #2650.
|
|
||||||
* - When closing gvim with an active terminal buffer, the dialog suggests
|
* - When closing gvim with an active terminal buffer, the dialog suggests
|
||||||
* saving the buffer. Should say something else. (Manas Thakur, #2215)
|
* saving the buffer. Should say something else. (Manas Thakur, #2215)
|
||||||
* Also: #2223
|
* Also: #2223
|
||||||
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
|
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
|
||||||
* - MS-Windows GUI: WinBar has tearoff item
|
* - MS-Windows GUI: WinBar has tearoff item
|
||||||
* - Adding WinBar to terminal window doesn't display, text isn't shifted down.
|
|
||||||
* - MS-Windows GUI: still need to type a key after shell exits? #1924
|
* - MS-Windows GUI: still need to type a key after shell exits? #1924
|
||||||
* - After executing a shell command the status line isn't redraw.
|
* - After executing a shell command the status line isn't redraw.
|
||||||
* - implement term_setsize()
|
* - implement term_setsize()
|
||||||
* - add test for giving error for invalid 'termsize' value.
|
* - add test for giving error for invalid 'termsize' value.
|
||||||
* - support minimal size when 'termsize' is "rows*cols".
|
* - support minimal size when 'termsize' is "rows*cols".
|
||||||
* - support minimal size when 'termsize' is empty?
|
* - support minimal size when 'termsize' is empty?
|
||||||
* - if the job in the terminal does not support the mouse, we can use the
|
|
||||||
* mouse in the Terminal window for copy/paste and scrolling.
|
|
||||||
* - GUI: when using tabs, focus in terminal, click on tab does not work.
|
* - GUI: when using tabs, focus in terminal, click on tab does not work.
|
||||||
* - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
|
* - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
|
||||||
* changes to "!shell".
|
* changes to "!shell".
|
||||||
@ -506,14 +506,12 @@ term_start(typval_T *argvar, jobopt_T *opt, int without_job, int forceit)
|
|||||||
* a deadlock if the job is waiting for Vim to read. */
|
* a deadlock if the job is waiting for Vim to read. */
|
||||||
channel_set_nonblock(term->tl_job->jv_channel, PART_IN);
|
channel_set_nonblock(term->tl_job->jv_channel, PART_IN);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!opt->jo_hidden)
|
if (!opt->jo_hidden)
|
||||||
{
|
{
|
||||||
++curbuf->b_locked;
|
++curbuf->b_locked;
|
||||||
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
|
||||||
--curbuf->b_locked;
|
--curbuf->b_locked;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (old_curbuf != NULL)
|
if (old_curbuf != NULL)
|
||||||
{
|
{
|
||||||
@ -938,9 +936,7 @@ term_convert_key(term_T *term, int c, char *buf)
|
|||||||
#ifdef FEAT_DND
|
#ifdef FEAT_DND
|
||||||
case K_DROP: return 0;
|
case K_DROP: return 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
case K_CURSORHOLD: return 0;
|
case K_CURSORHOLD: return 0;
|
||||||
#endif
|
|
||||||
case K_PS: vterm_keyboard_start_paste(vterm);
|
case K_PS: vterm_keyboard_start_paste(vterm);
|
||||||
other = TRUE;
|
other = TRUE;
|
||||||
break;
|
break;
|
||||||
|
4
src/ui.c
4
src/ui.c
@ -3299,13 +3299,11 @@ ui_focus_change(
|
|||||||
last_time = time(NULL);
|
last_time = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Fire the focus gained/lost autocommand.
|
* Fire the focus gained/lost autocommand.
|
||||||
*/
|
*/
|
||||||
need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED
|
need_redraw |= apply_autocmds(in_focus ? EVENT_FOCUSGAINED
|
||||||
: EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf);
|
: EVENT_FOCUSLOST, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (need_redraw)
|
if (need_redraw)
|
||||||
{
|
{
|
||||||
@ -3339,7 +3337,7 @@ ui_focus_change(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_MBYTE) || defined(PROTO)
|
#if defined(HAVE_INPUT_METHOD) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Save current Input Method status to specified place.
|
* Save current Input Method status to specified place.
|
||||||
*/
|
*/
|
||||||
|
@ -424,7 +424,6 @@ u_savecommon(
|
|||||||
term_change_in_curbuf();
|
term_change_in_curbuf();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Saving text for undo means we are going to make a change. Give a
|
* Saving text for undo means we are going to make a change. Give a
|
||||||
* warning for a read-only file before making the change, so that the
|
* warning for a read-only file before making the change, so that the
|
||||||
@ -439,7 +438,6 @@ u_savecommon(
|
|||||||
EMSG(_("E881: Line count changed unexpectedly"));
|
EMSG(_("E881: Line count changed unexpectedly"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef U_DEBUG
|
#ifdef U_DEBUG
|
||||||
@ -2631,11 +2629,9 @@ u_undoredo(int undo)
|
|||||||
int empty_buffer; /* buffer became empty */
|
int empty_buffer; /* buffer became empty */
|
||||||
u_header_T *curhead = curbuf->b_u_curhead;
|
u_header_T *curhead = curbuf->b_u_curhead;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't want autocommands using the undo structures here, they are
|
/* Don't want autocommands using the undo structures here, they are
|
||||||
* invalid till the end. */
|
* invalid till the end. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef U_DEBUG
|
#ifdef U_DEBUG
|
||||||
u_check(FALSE);
|
u_check(FALSE);
|
||||||
@ -2664,9 +2660,7 @@ u_undoredo(int undo)
|
|||||||
if (top > curbuf->b_ml.ml_line_count || top >= bot
|
if (top > curbuf->b_ml.ml_line_count || top >= bot
|
||||||
|| bot > curbuf->b_ml.ml_line_count + 1)
|
|| bot > curbuf->b_ml.ml_line_count + 1)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
IEMSG(_("E438: u_undo: line numbers wrong"));
|
IEMSG(_("E438: u_undo: line numbers wrong"));
|
||||||
changed(); /* don't want UNCHANGED now */
|
changed(); /* don't want UNCHANGED now */
|
||||||
return;
|
return;
|
||||||
@ -2891,9 +2885,7 @@ u_undoredo(int undo)
|
|||||||
* the undone/redone change. */
|
* the undone/redone change. */
|
||||||
curbuf->b_u_time_cur = curhead->uh_time;
|
curbuf->b_u_time_cur = curhead->uh_time;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
#ifdef U_DEBUG
|
#ifdef U_DEBUG
|
||||||
u_check(FALSE);
|
u_check(FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1372,7 +1372,6 @@ call_func(
|
|||||||
else
|
else
|
||||||
fp = find_func(rfname);
|
fp = find_func(rfname);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Trigger FuncUndefined event, may load the function. */
|
/* Trigger FuncUndefined event, may load the function. */
|
||||||
if (fp == NULL
|
if (fp == NULL
|
||||||
&& apply_autocmds(EVENT_FUNCUNDEFINED,
|
&& apply_autocmds(EVENT_FUNCUNDEFINED,
|
||||||
@ -1382,7 +1381,6 @@ call_func(
|
|||||||
/* executed an autocommand, search for the function again */
|
/* executed an autocommand, search for the function again */
|
||||||
fp = find_func(rfname);
|
fp = find_func(rfname);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
/* Try loading a package. */
|
/* Try loading a package. */
|
||||||
if (fp == NULL && script_autoload(rfname, TRUE) && !aborting())
|
if (fp == NULL && script_autoload(rfname, TRUE) && !aborting())
|
||||||
{
|
{
|
||||||
|
@ -78,11 +78,7 @@ static char *(features[]) =
|
|||||||
#else
|
#else
|
||||||
"-arabic",
|
"-arabic",
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
"+autocmd",
|
"+autocmd",
|
||||||
#else
|
|
||||||
"-autocmd",
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_AUTOSERVERNAME
|
#ifdef FEAT_AUTOSERVERNAME
|
||||||
"+autoservername",
|
"+autoservername",
|
||||||
#else
|
#else
|
||||||
@ -778,6 +774,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 */
|
||||||
|
/**/
|
||||||
|
1564,
|
||||||
/**/
|
/**/
|
||||||
1563,
|
1563,
|
||||||
/**/
|
/**/
|
||||||
|
14
src/vim.h
14
src/vim.h
@ -2118,6 +2118,20 @@ typedef enum {
|
|||||||
# define USE_MCH_ERRMSG
|
# define USE_MCH_ERRMSG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Whether IME is supported when XIM is not used. */
|
||||||
|
# if defined(FEAT_MBYTE_IME) && \
|
||||||
|
(!defined(FEAT_GUI_W32) || !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)))
|
||||||
|
# define IME_WITHOUT_XIM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(FEAT_MBYTE) && (defined(FEAT_XIM) \
|
||||||
|
|| defined(IME_WITHOUT_XIM) \
|
||||||
|
|| defined(FEAT_GUI_W32) \
|
||||||
|
|| defined(MACOS_CONVERT))
|
||||||
|
/* im_set_active() is available */
|
||||||
|
# define HAVE_INPUT_METHOD
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FEAT_MBYTE
|
#ifndef FEAT_MBYTE
|
||||||
# define after_pathsep(b, p) vim_ispathsep(*((p) - 1))
|
# define after_pathsep(b, p) vim_ispathsep(*((p) - 1))
|
||||||
# define transchar_byte(c) transchar(c)
|
# define transchar_byte(c) transchar(c)
|
||||||
|
107
src/window.c
107
src/window.c
@ -1437,13 +1437,11 @@ make_windows(
|
|||||||
if (count > 1)
|
if (count > 1)
|
||||||
last_status(TRUE);
|
last_status(TRUE);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Don't execute autocommands while creating the windows. Must do that
|
* Don't execute autocommands while creating the windows. Must do that
|
||||||
* when putting the buffers in the windows.
|
* when putting the buffers in the windows.
|
||||||
*/
|
*/
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* todo is number of windows left to create */
|
/* todo is number of windows left to create */
|
||||||
for (todo = count - 1; todo > 0; --todo)
|
for (todo = count - 1; todo > 0; --todo)
|
||||||
@ -1461,9 +1459,7 @@ make_windows(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* return actual number of windows */
|
/* return actual number of windows */
|
||||||
return (count - todo);
|
return (count - todo);
|
||||||
@ -2104,19 +2100,14 @@ close_windows(
|
|||||||
win_T *wp;
|
win_T *wp;
|
||||||
tabpage_T *tp, *nexttp;
|
tabpage_T *tp, *nexttp;
|
||||||
int h = tabline_height();
|
int h = tabline_height();
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int count = tabpage_index(NULL);
|
int count = tabpage_index(NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
++RedrawingDisabled;
|
++RedrawingDisabled;
|
||||||
|
|
||||||
for (wp = firstwin; wp != NULL && !ONE_WINDOW; )
|
for (wp = firstwin; wp != NULL && !ONE_WINDOW; )
|
||||||
{
|
{
|
||||||
if (wp->w_buffer == buf && (!keep_curwin || wp != curwin)
|
if (wp->w_buffer == buf && (!keep_curwin || wp != curwin)
|
||||||
#ifdef FEAT_AUTOCMD
|
&& !(wp->w_closing || wp->w_buffer->b_locked > 0))
|
||||||
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (win_close(wp, FALSE) == FAIL)
|
if (win_close(wp, FALSE) == FAIL)
|
||||||
/* If closing the window fails give up, to avoid looping
|
/* If closing the window fails give up, to avoid looping
|
||||||
@ -2137,10 +2128,7 @@ close_windows(
|
|||||||
if (tp != curtab)
|
if (tp != curtab)
|
||||||
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
|
for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
|
||||||
if (wp->w_buffer == buf
|
if (wp->w_buffer == buf
|
||||||
#ifdef FEAT_AUTOCMD
|
&& !(wp->w_closing || wp->w_buffer->b_locked > 0))
|
||||||
&& !(wp->w_closing || wp->w_buffer->b_locked > 0)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
win_close_othertab(wp, FALSE, tp);
|
win_close_othertab(wp, FALSE, tp);
|
||||||
|
|
||||||
@ -2153,10 +2141,8 @@ close_windows(
|
|||||||
|
|
||||||
--RedrawingDisabled;
|
--RedrawingDisabled;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (count != tabpage_index(NULL))
|
if (count != tabpage_index(NULL))
|
||||||
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
|
|
||||||
redraw_tabline = TRUE;
|
redraw_tabline = TRUE;
|
||||||
if (h != tabline_height())
|
if (h != tabline_height())
|
||||||
@ -2181,7 +2167,6 @@ last_window(void)
|
|||||||
int
|
int
|
||||||
one_window(void)
|
one_window(void)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
int seen_one = FALSE;
|
int seen_one = FALSE;
|
||||||
|
|
||||||
@ -2195,9 +2180,6 @@ one_window(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
|
||||||
return ONE_WINDOW;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2212,9 +2194,7 @@ close_last_window_tabpage(
|
|||||||
{
|
{
|
||||||
if (ONE_WINDOW)
|
if (ONE_WINDOW)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
buf_T *old_curbuf = curbuf;
|
buf_T *old_curbuf = curbuf;
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Closing the last window in a tab page. First go to another tab
|
* Closing the last window in a tab page. First go to another tab
|
||||||
@ -2239,13 +2219,11 @@ close_last_window_tabpage(
|
|||||||
}
|
}
|
||||||
/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
|
/* Since goto_tabpage_tp above did not trigger *Enter autocommands, do
|
||||||
* that now. */
|
* that now. */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
|
||||||
if (old_curbuf != curbuf)
|
if (old_curbuf != curbuf)
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -2262,9 +2240,7 @@ close_last_window_tabpage(
|
|||||||
win_close(win_T *win, int free_buf)
|
win_close(win_T *win, int free_buf)
|
||||||
{
|
{
|
||||||
win_T *wp;
|
win_T *wp;
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int other_buffer = FALSE;
|
int other_buffer = FALSE;
|
||||||
#endif
|
|
||||||
int close_curwin = FALSE;
|
int close_curwin = FALSE;
|
||||||
int dir;
|
int dir;
|
||||||
int help_window = FALSE;
|
int help_window = FALSE;
|
||||||
@ -2277,7 +2253,6 @@ win_close(win_T *win, int free_buf)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (win->w_closing || (win->w_buffer != NULL
|
if (win->w_closing || (win->w_buffer != NULL
|
||||||
&& win->w_buffer->b_locked > 0))
|
&& win->w_buffer->b_locked > 0))
|
||||||
return FAIL; /* window is already being closed */
|
return FAIL; /* window is already being closed */
|
||||||
@ -2291,7 +2266,6 @@ win_close(win_T *win, int free_buf)
|
|||||||
EMSG(_("E814: Cannot close window, only autocmd window would remain"));
|
EMSG(_("E814: Cannot close window, only autocmd window would remain"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* When closing the last window in a tab page first go to another tab page
|
/* When closing the last window in a tab page first go to another tab page
|
||||||
* and then close the window and the tab page to avoid that curwin and
|
* and then close the window and the tab page to avoid that curwin and
|
||||||
@ -2306,7 +2280,6 @@ win_close(win_T *win, int free_buf)
|
|||||||
else
|
else
|
||||||
clear_snapshot(curtab, SNAP_HELP_IDX);
|
clear_snapshot(curtab, SNAP_HELP_IDX);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (win == curwin)
|
if (win == curwin)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -2337,13 +2310,12 @@ win_close(win_T *win, int free_buf)
|
|||||||
win->w_closing = FALSE;
|
win->w_closing = FALSE;
|
||||||
if (last_window())
|
if (last_window())
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/* autocmds may abort script processing */
|
/* autocmds may abort script processing */
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return FAIL;
|
return FAIL;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
/* Avoid trouble with scrollbars that are going to be deleted in
|
/* Avoid trouble with scrollbars that are going to be deleted in
|
||||||
@ -2366,14 +2338,10 @@ win_close(win_T *win, int free_buf)
|
|||||||
bufref_T bufref;
|
bufref_T bufref;
|
||||||
|
|
||||||
set_bufref(&bufref, curbuf);
|
set_bufref(&bufref, curbuf);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
win->w_closing = TRUE;
|
win->w_closing = TRUE;
|
||||||
#endif
|
|
||||||
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
|
close_buffer(win, win->w_buffer, free_buf ? DOBUF_UNLOAD : 0, TRUE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (win_valid_any_tab(win))
|
if (win_valid_any_tab(win))
|
||||||
win->w_closing = FALSE;
|
win->w_closing = FALSE;
|
||||||
#endif
|
|
||||||
/* Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
/* Make sure curbuf is valid. It can become invalid if 'bufhidden' is
|
||||||
* "wipe". */
|
* "wipe". */
|
||||||
if (!bufref_valid(&bufref))
|
if (!bufref_valid(&bufref))
|
||||||
@ -2455,11 +2423,9 @@ win_close(win_T *win, int free_buf)
|
|||||||
if (close_curwin)
|
if (close_curwin)
|
||||||
{
|
{
|
||||||
win_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE);
|
win_enter_ext(wp, FALSE, TRUE, FALSE, TRUE, TRUE);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (other_buffer)
|
if (other_buffer)
|
||||||
/* careful: after this wp and win may be invalid! */
|
/* careful: after this wp and win may be invalid! */
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2498,13 +2464,11 @@ win_close_othertab(win_T *win, int free_buf, tabpage_T *tp)
|
|||||||
tabpage_T *ptp = NULL;
|
tabpage_T *ptp = NULL;
|
||||||
int free_tp = FALSE;
|
int free_tp = FALSE;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Get here with win->w_buffer == NULL when win_close() detects the tab
|
/* Get here with win->w_buffer == NULL when win_close() detects the tab
|
||||||
* page changed. */
|
* page changed. */
|
||||||
if (win->w_closing || (win->w_buffer != NULL
|
if (win->w_closing || (win->w_buffer != NULL
|
||||||
&& win->w_buffer->b_locked > 0))
|
&& win->w_buffer->b_locked > 0))
|
||||||
return; /* window is already being closed */
|
return; /* window is already being closed */
|
||||||
#endif
|
|
||||||
|
|
||||||
if (win->w_buffer != NULL)
|
if (win->w_buffer != NULL)
|
||||||
/* Close the link to the buffer. */
|
/* Close the link to the buffer. */
|
||||||
@ -2586,13 +2550,11 @@ win_free_all(void)
|
|||||||
while (first_tabpage->tp_next != NULL)
|
while (first_tabpage->tp_next != NULL)
|
||||||
tabpage_close(TRUE);
|
tabpage_close(TRUE);
|
||||||
|
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (aucmd_win != NULL)
|
if (aucmd_win != NULL)
|
||||||
{
|
{
|
||||||
(void)win_free_mem(aucmd_win, &dummy, NULL);
|
(void)win_free_mem(aucmd_win, &dummy, NULL);
|
||||||
aucmd_win = NULL;
|
aucmd_win = NULL;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
while (firstwin != NULL)
|
while (firstwin != NULL)
|
||||||
(void)win_free_mem(firstwin, &dummy, NULL);
|
(void)win_free_mem(firstwin, &dummy, NULL);
|
||||||
@ -3331,11 +3293,7 @@ close_others(
|
|||||||
|
|
||||||
if (one_window())
|
if (one_window())
|
||||||
{
|
{
|
||||||
if (message
|
if (message && !autocmd_busy)
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
&& !autocmd_busy
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
MSG(_(m_onlyone));
|
MSG(_(m_onlyone));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3349,26 +3307,22 @@ close_others(
|
|||||||
|
|
||||||
/* Check if it's allowed to abandon this window */
|
/* Check if it's allowed to abandon this window */
|
||||||
r = can_abandon(wp->w_buffer, forceit);
|
r = can_abandon(wp->w_buffer, forceit);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!win_valid(wp)) /* autocommands messed wp up */
|
if (!win_valid(wp)) /* autocommands messed wp up */
|
||||||
{
|
{
|
||||||
nextwp = firstwin;
|
nextwp = firstwin;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
{
|
||||||
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
||||||
if (message && (p_confirm || cmdmod.confirm) && p_write)
|
if (message && (p_confirm || cmdmod.confirm) && p_write)
|
||||||
{
|
{
|
||||||
dialog_changed(wp->w_buffer, FALSE);
|
dialog_changed(wp->w_buffer, FALSE);
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
if (!win_valid(wp)) /* autocommands messed wp up */
|
if (!win_valid(wp)) /* autocommands messed wp up */
|
||||||
{
|
{
|
||||||
nextwp = firstwin;
|
nextwp = firstwin;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
if (bufIsChanged(wp->w_buffer))
|
if (bufIsChanged(wp->w_buffer))
|
||||||
#endif
|
#endif
|
||||||
@ -3443,7 +3397,6 @@ win_alloc_first(void)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
|
||||||
/*
|
/*
|
||||||
* Init "aucmd_win". This can only be done after the first
|
* Init "aucmd_win". This can only be done after the first
|
||||||
* window is fully initialized, thus it can't be in win_alloc_first().
|
* window is fully initialized, thus it can't be in win_alloc_first().
|
||||||
@ -3459,7 +3412,6 @@ win_alloc_aucmd_win(void)
|
|||||||
new_frame(aucmd_win);
|
new_frame(aucmd_win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate the first window or the first window in a new tab page.
|
* Allocate the first window or the first window in a new tab page.
|
||||||
@ -3663,12 +3615,10 @@ win_new_tabpage(int after)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
redraw_all_later(CLEAR);
|
redraw_all_later(CLEAR);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABNEW, NULL, NULL, FALSE, curbuf);
|
||||||
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_TABENTER, NULL, NULL, FALSE, curbuf);
|
||||||
#endif
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3710,21 +3660,17 @@ make_tabpages(int maxcount)
|
|||||||
if (count > p_tpm)
|
if (count > p_tpm)
|
||||||
count = p_tpm;
|
count = p_tpm;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/*
|
/*
|
||||||
* Don't execute autocommands while creating the tab pages. Must do that
|
* Don't execute autocommands while creating the tab pages. Must do that
|
||||||
* when putting the buffers in the windows.
|
* when putting the buffers in the windows.
|
||||||
*/
|
*/
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
for (todo = count - 1; todo > 0; --todo)
|
for (todo = count - 1; todo > 0; --todo)
|
||||||
if (win_new_tabpage(0) == FAIL)
|
if (win_new_tabpage(0) == FAIL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
/* return actual number of tab pages */
|
/* return actual number of tab pages */
|
||||||
return (count - todo);
|
return (count - todo);
|
||||||
@ -3841,7 +3787,6 @@ leave_tabpage(
|
|||||||
tabpage_T *tp = curtab;
|
tabpage_T *tp = curtab;
|
||||||
|
|
||||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (trigger_leave_autocmds)
|
if (trigger_leave_autocmds)
|
||||||
{
|
{
|
||||||
if (new_curbuf != curbuf)
|
if (new_curbuf != curbuf)
|
||||||
@ -3857,7 +3802,6 @@ leave_tabpage(
|
|||||||
if (curtab != tp)
|
if (curtab != tp)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(FEAT_GUI)
|
#if defined(FEAT_GUI)
|
||||||
/* Remove the scrollbars. They may be added back later. */
|
/* Remove the scrollbars. They may be added back later. */
|
||||||
if (gui.in_use)
|
if (gui.in_use)
|
||||||
@ -3929,7 +3873,6 @@ enter_tabpage(
|
|||||||
gui_may_update_scrollbars();
|
gui_may_update_scrollbars();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Apply autocommands after updating the display, when 'rows' and
|
/* Apply autocommands after updating the display, when 'rows' and
|
||||||
* 'columns' have been set correctly. */
|
* 'columns' have been set correctly. */
|
||||||
if (trigger_enter_autocmds)
|
if (trigger_enter_autocmds)
|
||||||
@ -3938,7 +3881,6 @@ enter_tabpage(
|
|||||||
if (old_curbuf != curbuf)
|
if (old_curbuf != curbuf)
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
redraw_all_later(CLEAR);
|
redraw_all_later(CLEAR);
|
||||||
}
|
}
|
||||||
@ -4131,10 +4073,8 @@ win_goto(win_T *wp)
|
|||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (curbuf_locked())
|
if (curbuf_locked())
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wp->w_buffer != curbuf)
|
if (wp->w_buffer != curbuf)
|
||||||
reset_VIsual_and_resel();
|
reset_VIsual_and_resel();
|
||||||
@ -4337,14 +4277,11 @@ win_enter_ext(
|
|||||||
int trigger_enter_autocmds UNUSED,
|
int trigger_enter_autocmds UNUSED,
|
||||||
int trigger_leave_autocmds UNUSED)
|
int trigger_leave_autocmds UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
int other_buffer = FALSE;
|
int other_buffer = FALSE;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (wp == curwin && !curwin_invalid) /* nothing to do */
|
if (wp == curwin && !curwin_invalid) /* nothing to do */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (!curwin_invalid && trigger_leave_autocmds)
|
if (!curwin_invalid && trigger_leave_autocmds)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -4360,13 +4297,12 @@ win_enter_ext(
|
|||||||
apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
|
||||||
if (!win_valid(wp))
|
if (!win_valid(wp))
|
||||||
return;
|
return;
|
||||||
# ifdef FEAT_EVAL
|
#ifdef FEAT_EVAL
|
||||||
/* autocmds may abort script processing */
|
/* autocmds may abort script processing */
|
||||||
if (aborting())
|
if (aborting())
|
||||||
return;
|
return;
|
||||||
# endif
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* sync undo before leaving the current buffer */
|
/* sync undo before leaving the current buffer */
|
||||||
if (undo_sync && curbuf != wp->w_buffer)
|
if (undo_sync && curbuf != wp->w_buffer)
|
||||||
@ -4417,7 +4353,6 @@ win_enter_ext(
|
|||||||
shorten_fnames(TRUE);
|
shorten_fnames(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (trigger_new_autocmds)
|
if (trigger_new_autocmds)
|
||||||
apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_WINNEW, NULL, NULL, FALSE, curbuf);
|
||||||
if (trigger_enter_autocmds)
|
if (trigger_enter_autocmds)
|
||||||
@ -4426,7 +4361,6 @@ win_enter_ext(
|
|||||||
if (other_buffer)
|
if (other_buffer)
|
||||||
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_TITLE
|
#ifdef FEAT_TITLE
|
||||||
maketitle();
|
maketitle();
|
||||||
@ -4544,12 +4478,11 @@ win_alloc(win_T *after UNUSED, int hidden UNUSED)
|
|||||||
init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);
|
init_var_dict(new_wp->w_vars, &new_wp->w_winvar, VAR_SCOPE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute autocommands while the window is not properly
|
/* Don't execute autocommands while the window is not properly
|
||||||
* initialized yet. gui_create_scrollbar() may trigger a FocusGained
|
* initialized yet. gui_create_scrollbar() may trigger a FocusGained
|
||||||
* event. */
|
* event. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* link the window in the window list
|
* link the window in the window list
|
||||||
*/
|
*/
|
||||||
@ -4585,9 +4518,7 @@ win_alloc(win_T *after UNUSED, int hidden UNUSED)
|
|||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
foldInitWin(new_wp);
|
foldInitWin(new_wp);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
new_wp->w_match_head = NULL;
|
new_wp->w_match_head = NULL;
|
||||||
new_wp->w_next_match_id = 4;
|
new_wp->w_next_match_id = 4;
|
||||||
@ -4614,11 +4545,9 @@ win_free(
|
|||||||
/* reduce the reference count to the argument list. */
|
/* reduce the reference count to the argument list. */
|
||||||
alist_unlink(wp->w_alist);
|
alist_unlink(wp->w_alist);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
/* Don't execute autocommands while the window is halfway being deleted.
|
/* Don't execute autocommands while the window is halfway being deleted.
|
||||||
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
|
* gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FEAT_LUA
|
#ifdef FEAT_LUA
|
||||||
lua_window_free(wp);
|
lua_window_free(wp);
|
||||||
@ -4708,23 +4637,17 @@ win_free(
|
|||||||
vim_free(wp->w_p_cc_cols);
|
vim_free(wp->w_p_cc_cols);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (wp != aucmd_win)
|
if (wp != aucmd_win)
|
||||||
#endif
|
|
||||||
win_remove(wp, tp);
|
win_remove(wp, tp);
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
if (autocmd_busy)
|
if (autocmd_busy)
|
||||||
{
|
{
|
||||||
wp->w_next = au_pending_free_win;
|
wp->w_next = au_pending_free_win;
|
||||||
au_pending_free_win = wp;
|
au_pending_free_win = wp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
vim_free(wp);
|
vim_free(wp);
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6426,11 +6349,7 @@ only_one_window(void)
|
|||||||
# ifdef FEAT_QUICKFIX
|
# ifdef FEAT_QUICKFIX
|
||||||
|| wp->w_p_pvw
|
|| wp->w_p_pvw
|
||||||
# endif
|
# endif
|
||||||
) || wp == curwin)
|
) || wp == curwin) && wp != aucmd_win)
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
&& wp != aucmd_win
|
|
||||||
# endif
|
|
||||||
)
|
|
||||||
++count;
|
++count;
|
||||||
return (count <= 1);
|
return (count <= 1);
|
||||||
}
|
}
|
||||||
@ -6613,9 +6532,7 @@ switch_win(
|
|||||||
tabpage_T *tp,
|
tabpage_T *tp,
|
||||||
int no_display)
|
int no_display)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
# endif
|
|
||||||
*save_curwin = curwin;
|
*save_curwin = curwin;
|
||||||
if (tp != NULL)
|
if (tp != NULL)
|
||||||
{
|
{
|
||||||
@ -6667,9 +6584,7 @@ restore_win(
|
|||||||
curwin = save_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
}
|
}
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6679,9 +6594,7 @@ restore_win(
|
|||||||
void
|
void
|
||||||
switch_buffer(bufref_T *save_curbuf, buf_T *buf)
|
switch_buffer(bufref_T *save_curbuf, buf_T *buf)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
# endif
|
|
||||||
set_bufref(save_curbuf, curbuf);
|
set_bufref(save_curbuf, curbuf);
|
||||||
--curbuf->b_nwindows;
|
--curbuf->b_nwindows;
|
||||||
curbuf = buf;
|
curbuf = buf;
|
||||||
@ -6695,9 +6608,7 @@ switch_buffer(bufref_T *save_curbuf, buf_T *buf)
|
|||||||
void
|
void
|
||||||
restore_buffer(bufref_T *save_curbuf)
|
restore_buffer(bufref_T *save_curbuf)
|
||||||
{
|
{
|
||||||
# ifdef FEAT_AUTOCMD
|
|
||||||
unblock_autocmds();
|
unblock_autocmds();
|
||||||
# endif
|
|
||||||
/* Check for valid buffer, just in case. */
|
/* Check for valid buffer, just in case. */
|
||||||
if (bufref_valid(save_curbuf))
|
if (bufref_valid(save_curbuf))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user