summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-12-18 22:02:33 +0000
committerBram Moolenaar <Bram@vim.org>2005-12-18 22:02:33 +0000
commitd35f9711d4558f8784e65531a152d38d1dabbe72 (patch)
treeb87fb3537c2ac512ca97a6e342c1cb9762e40892 /src
parentda1b1a735765071185281ce86a379ea0d078cb17 (diff)
updated for version 7.0173
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c17
-rw-r--r--src/gui.c5
-rw-r--r--src/os_unix.c7
-rw-r--r--src/os_win32.c3
4 files changed, 22 insertions, 10 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 0cfbc22227..5b083f950a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -7483,6 +7483,8 @@ au_event_restore(old_ei)
* :autocmd bufleave * set tw=79 nosmartindent ic infercase
*
* :autocmd * *.c show all autocommands for *.c files.
+ *
+ * Mostly a {group} argument can optionally appear before <event>.
*/
void
do_autocmd(arg, forceit)
@@ -8168,11 +8170,26 @@ apply_autocmds_retval(event, fname, fname_io, force, buf, retval)
}
#if defined(FEAT_AUTOCMD) || defined(PROTO)
+/*
+ * Return TRUE when there is a CursorHold autocommand defined.
+ */
int
has_cursorhold()
{
return (first_autopat[(int)EVENT_CURSORHOLD] != NULL);
}
+
+/*
+ * Return TRUE if the CursorHold event can be triggered.
+ */
+ int
+trigger_cursorhold()
+{
+ return (!did_cursorhold
+ && has_cursorhold()
+ && !Recording
+ && get_real_state() == NORMAL_BUSY);
+}
#endif
static int
diff --git a/src/gui.c b/src/gui.c
index 32416cb59c..75085ced29 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -2653,8 +2653,7 @@ gui_wait_for_chars(wtime)
if (gui_mch_wait_for_chars(p_ut) == OK)
retval = OK;
#ifdef FEAT_AUTOCMD
- else if (!did_cursorhold && has_cursorhold()
- && get_real_state() == NORMAL_BUSY)
+ else if (trigger_cursorhold())
{
char_u buf[3];
@@ -4639,7 +4638,7 @@ gui_do_findrepl(flags, find_text, repl_text, down)
u_sync();
del_bytes((long)(regmatch.endp[0] - regmatch.startp[0]),
- FALSE);
+ FALSE, FALSE);
ins_str(repl_text);
}
}
diff --git a/src/os_unix.c b/src/os_unix.c
index 6165e9f6ad..73693b632f 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -342,11 +342,8 @@ mch_inchar(buf, maxlen, wtime, tb_change_cnt)
if (WaitForChar(p_ut) == 0)
{
#ifdef FEAT_AUTOCMD
- if (!did_cursorhold
- && has_cursorhold()
- && get_real_state() == NORMAL_BUSY
- && maxlen >= 3
- && !typebuf_changed(tb_change_cnt))
+ if (trigger_cursorhold() && maxlen >= 3
+ && !typebuf_changed(tb_change_cnt))
{
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;
diff --git a/src/os_win32.c b/src/os_win32.c
index 91bc87e882..08df912cee 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1383,8 +1383,7 @@ mch_inchar(
if (!WaitForChar(p_ut))
{
#ifdef FEAT_AUTOCMD
- if (!did_cursorhold && has_cursorhold()
- && get_real_state() == NORMAL_BUSY && maxlen >= 3)
+ if (trigger_cursorhold() && maxlen >= 3)
{
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;