summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-29 15:18:57 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-29 15:18:57 +0200
commitb9c31e71f5a4653a27e81c21226039bfa35b9131 (patch)
tree13ab81b2945c99ef6b8f256dac36c0ea4427e394
parent177778575148e265c0e32ec2abf2d2c615f5ead5 (diff)
downloadvim-git-b9c31e71f5a4653a27e81c21226039bfa35b9131.tar.gz
patch 8.0.0018v8.0.0018
Problem: When using ":sleep" channel input is not handled. Solution: When there is a channel check for input also when not in raw mode. Check every 100 msec.
-rw-r--r--src/channel.c6
-rw-r--r--src/ex_docmd.c11
-rw-r--r--src/os_amiga.c2
-rw-r--r--src/os_unix.c5
-rw-r--r--src/os_win32.c4
-rw-r--r--src/proto/channel.pro1
-rw-r--r--src/proto/os_amiga.pro2
-rw-r--r--src/proto/os_unix.pro2
-rw-r--r--src/proto/os_win32.pro2
-rw-r--r--src/proto/ui.pro1
-rw-r--r--src/ui.c12
-rw-r--r--src/version.c2
12 files changed, 40 insertions, 10 deletions
diff --git a/src/channel.c b/src/channel.c
index 0bab47a62..13fb65302 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -341,6 +341,12 @@ add_channel(void)
return channel;
}
+ int
+has_any_channel(void)
+{
+ return first_channel != NULL;
+}
+
/*
* Called when the refcount of a channel is zero.
* Return TRUE if "channel" has a callback and the associated job wasn't
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index eef559506..09b901996 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -9065,8 +9065,17 @@ do_sleep(long msec)
wait_now = due_time;
}
#endif
+#ifdef FEAT_JOB_CHANNEL
+ if (has_any_channel() && wait_now > 100L)
+ wait_now = 100L;
+#endif
ui_delay(wait_now, TRUE);
- ui_breakcheck();
+#ifdef FEAT_JOB_CHANNEL
+ if (has_any_channel())
+ ui_breakcheck_force(TRUE);
+ else
+#endif
+ ui_breakcheck();
#ifdef MESSAGE_QUEUE
/* Process the netbeans and clientserver messages that may have been
* received in the call to ui_breakcheck() when the GUI is in use. This
diff --git a/src/os_amiga.c b/src/os_amiga.c
index 4478093df..9266380d6 100644
--- a/src/os_amiga.c
+++ b/src/os_amiga.c
@@ -1381,7 +1381,7 @@ mch_call_shell(
* trouble with lattice-c programs.
*/
void
-mch_breakcheck(void)
+mch_breakcheck(int force)
{
if (SetSignal(0L, (long)(SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D|SIGBREAKF_CTRL_E|SIGBREAKF_CTRL_F)) & SIGBREAKF_CTRL_C)
got_int = TRUE;
diff --git a/src/os_unix.c b/src/os_unix.c
index 5f1c48764..107a47482 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5364,9 +5364,10 @@ mch_clear_job(job_T *job)
* In cooked mode we should get SIGINT, no need to check.
*/
void
-mch_breakcheck(void)
+mch_breakcheck(int force)
{
- if (curr_tmode == TMODE_RAW && RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
+ if ((curr_tmode == TMODE_RAW || force)
+ && RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
fill_input_buf(FALSE);
}
diff --git a/src/os_win32.c b/src/os_win32.c
index 0607bd2ef..5eacce635 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -6187,10 +6187,10 @@ mch_remove(char_u *name)
/*
- * check for an "interrupt signal": CTRL-break or CTRL-C
+ * Check for an "interrupt signal": CTRL-break or CTRL-C.
*/
void
-mch_breakcheck(void)
+mch_breakcheck(int force)
{
#ifndef FEAT_GUI_W32 /* never used */
if (g_fCtrlCPressed || g_fCBrkPressed)
diff --git a/src/proto/channel.pro b/src/proto/channel.pro
index e056d5ffe..53c5dab94 100644
--- a/src/proto/channel.pro
+++ b/src/proto/channel.pro
@@ -4,6 +4,7 @@ int ch_log_active(void);
void ch_log(channel_T *ch, char *msg);
void ch_logs(channel_T *ch, char *msg, char *name);
channel_T *add_channel(void);
+int has_any_channel(void);
int channel_unref(channel_T *channel);
int free_unused_channels_contents(int copyID, int mask);
void free_unused_channels(int copyID, int mask);
diff --git a/src/proto/os_amiga.pro b/src/proto/os_amiga.pro
index b1d0134b7..b781680a8 100644
--- a/src/proto/os_amiga.pro
+++ b/src/proto/os_amiga.pro
@@ -36,7 +36,7 @@ int mch_get_shellsize(void);
void mch_set_shellsize(void);
void mch_new_shellsize(void);
int mch_call_shell(char_u *cmd, int options);
-void mch_breakcheck(void);
+void mch_breakcheck(int force);
long Chk_Abort(void);
int mch_expandpath(garray_T *gap, char_u *pat, int flags);
int mch_has_exp_wildcard(char_u *p);
diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro
index 1d025e828..b1e9b8e29 100644
--- a/src/proto/os_unix.pro
+++ b/src/proto/os_unix.pro
@@ -61,7 +61,7 @@ void mch_start_job(char **argv, job_T *job, jobopt_T *options);
char *mch_job_status(job_T *job);
int mch_stop_job(job_T *job, char_u *how);
void mch_clear_job(job_T *job);
-void mch_breakcheck(void);
+void mch_breakcheck(int force);
int mch_expandpath(garray_T *gap, char_u *path, int flags);
int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags);
int mch_has_exp_wildcard(char_u *p);
diff --git a/src/proto/os_win32.pro b/src/proto/os_win32.pro
index 19c59ec96..4e6af5bd2 100644
--- a/src/proto/os_win32.pro
+++ b/src/proto/os_win32.pro
@@ -48,7 +48,7 @@ void mch_set_normal_colors(void);
void mch_write(char_u *s, int len);
void mch_delay(long msec, int ignoreinput);
int mch_remove(char_u *name);
-void mch_breakcheck(void);
+void mch_breakcheck(int force);
long_u mch_total_mem(int special);
int mch_wrename(WCHAR *wold, WCHAR *wnew);
int mch_rename(const char *pszOldFile, const char *pszNewFile);
diff --git a/src/proto/ui.pro b/src/proto/ui.pro
index 072e0c496..dbb721396 100644
--- a/src/proto/ui.pro
+++ b/src/proto/ui.pro
@@ -10,6 +10,7 @@ int ui_get_shellsize(void);
void ui_set_shellsize(int mustset);
void ui_new_shellsize(void);
void ui_breakcheck(void);
+void ui_breakcheck_force(int force);
void clip_init(int can_use);
void clip_update_selection(VimClipboard *clip);
void clip_own_selection(VimClipboard *cbd);
diff --git a/src/ui.c b/src/ui.c
index f6c039bd5..ad2919052 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -353,12 +353,22 @@ ui_new_shellsize(void)
void
ui_breakcheck(void)
{
+ ui_breakcheck_force(FALSE);
+}
+
+/*
+ * When "force" is true also check when the terminal is not in raw mode.
+ * This is useful to read input on channels.
+ */
+ void
+ui_breakcheck_force(int force)
+{
#ifdef FEAT_GUI
if (gui.in_use)
gui_mch_update();
else
#endif
- mch_breakcheck();
+ mch_breakcheck(force);
}
/*****************************************************************************
diff --git a/src/version.c b/src/version.c
index 12c5505ef..eb1c4ab2a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 18,
+/**/
17,
/**/
16,