]> granicus.if.org Git - vim/commitdiff
patch 8.0.0018 v8.0.0018
authorBram Moolenaar <Bram@vim.org>
Thu, 29 Sep 2016 13:18:57 +0000 (15:18 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 29 Sep 2016 13:18:57 +0000 (15:18 +0200)
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.

12 files changed:
src/channel.c
src/ex_docmd.c
src/os_amiga.c
src/os_unix.c
src/os_win32.c
src/proto/channel.pro
src/proto/os_amiga.pro
src/proto/os_unix.pro
src/proto/os_win32.pro
src/proto/ui.pro
src/ui.c
src/version.c

index 0bab47a6263cd58f42a7d2bdf376dc67d542716c..13fb65302b5d1d8c9e4939f0a397499550ae419b 100644 (file)
@@ -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
index eef559506d0dbe2acd88b856cae8f849a209b2de..09b90199635f43b85e6ab6c1bebc88153e93de57 100644 (file)
@@ -9064,9 +9064,18 @@ do_sleep(long msec)
            if (due_time > 0 && due_time < wait_now)
                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
index 4478093df4930e47229d1dd73c6d1ef89eddf384..9266380d6dd9d1c6a8d4453fb03f045ad14be3c9 100644 (file)
@@ -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;
index 5f1c4876466bfcc1a146ed0e652f3dbb1e272a59..107a474820be4a4c2480ef26ffa66286d9916a39 100644 (file)
@@ -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);
 }
 
index 0607bd2efe23cb1efb1b86d714c393f4dc27fe48..5eacce635c3a5e3c857bac7630cbba9cc7dcd531 100644 (file)
@@ -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)
index e056d5ffe0bd27d50ff45238e29d04e45b38eede..53c5dab94c9080859cdc9d113e4a42f242b372b6 100644 (file)
@@ -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);
index b1d0134b7e29c1be37d7015006f29a31f2cdd1f3..b781680a8c2153252d2817550f46e5a90a463ec2 100644 (file)
@@ -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);
index 1d025e8284d60def3ab3827162da8fdc0ea1aca9..b1e9b8e299975b30922fd0bd4ed44baf1b95f62a 100644 (file)
@@ -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);
index 19c59ec96141d59c69b3041bd11ba530e74d359c..4e6af5bd2f4ad4e13ef3e97d0727d545e78905e4 100644 (file)
@@ -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);
index 072e0c496395f0b865f83d1473e7732c13c6c60d..dbb7213963899a489f1fcc435bcb7778b6ed20dc 100644 (file)
@@ -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);
index f6c039bd59320642242e677aae523e7bbfee887e..ad2919052e472894a68c992c151b8cf5959642e0 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -352,13 +352,23 @@ 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);
 }
 
 /*****************************************************************************
index 12c5505efed4d948be65ded8ffc83385cfb48bbb..eb1c4ab2a854e60b69bef98fb8c24f2f8324995e 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    18,
 /**/
     17,
 /**/