Skip to content

Commit b9c31e7

Browse files
committed
patch 8.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.
1 parent 1777785 commit b9c31e7

12 files changed

Lines changed: 40 additions & 10 deletions

File tree

src/channel.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ add_channel(void)
341341
return channel;
342342
}
343343

344+
int
345+
has_any_channel(void)
346+
{
347+
return first_channel != NULL;
348+
}
349+
344350
/*
345351
* Called when the refcount of a channel is zero.
346352
* Return TRUE if "channel" has a callback and the associated job wasn't

src/ex_docmd.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9064,9 +9064,18 @@ do_sleep(long msec)
90649064
if (due_time > 0 && due_time < wait_now)
90659065
wait_now = due_time;
90669066
}
9067+
#endif
9068+
#ifdef FEAT_JOB_CHANNEL
9069+
if (has_any_channel() && wait_now > 100L)
9070+
wait_now = 100L;
90679071
#endif
90689072
ui_delay(wait_now, TRUE);
9069-
ui_breakcheck();
9073+
#ifdef FEAT_JOB_CHANNEL
9074+
if (has_any_channel())
9075+
ui_breakcheck_force(TRUE);
9076+
else
9077+
#endif
9078+
ui_breakcheck();
90709079
#ifdef MESSAGE_QUEUE
90719080
/* Process the netbeans and clientserver messages that may have been
90729081
* received in the call to ui_breakcheck() when the GUI is in use. This

src/os_amiga.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ mch_call_shell(
13811381
* trouble with lattice-c programs.
13821382
*/
13831383
void
1384-
mch_breakcheck(void)
1384+
mch_breakcheck(int force)
13851385
{
13861386
if (SetSignal(0L, (long)(SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D|SIGBREAKF_CTRL_E|SIGBREAKF_CTRL_F)) & SIGBREAKF_CTRL_C)
13871387
got_int = TRUE;

src/os_unix.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,9 +5364,10 @@ mch_clear_job(job_T *job)
53645364
* In cooked mode we should get SIGINT, no need to check.
53655365
*/
53665366
void
5367-
mch_breakcheck(void)
5367+
mch_breakcheck(int force)
53685368
{
5369-
if (curr_tmode == TMODE_RAW && RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
5369+
if ((curr_tmode == TMODE_RAW || force)
5370+
&& RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
53705371
fill_input_buf(FALSE);
53715372
}
53725373

src/os_win32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6187,10 +6187,10 @@ mch_remove(char_u *name)
61876187

61886188

61896189
/*
6190-
* check for an "interrupt signal": CTRL-break or CTRL-C
6190+
* Check for an "interrupt signal": CTRL-break or CTRL-C.
61916191
*/
61926192
void
6193-
mch_breakcheck(void)
6193+
mch_breakcheck(int force)
61946194
{
61956195
#ifndef FEAT_GUI_W32 /* never used */
61966196
if (g_fCtrlCPressed || g_fCBrkPressed)

src/proto/channel.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ int ch_log_active(void);
44
void ch_log(channel_T *ch, char *msg);
55
void ch_logs(channel_T *ch, char *msg, char *name);
66
channel_T *add_channel(void);
7+
int has_any_channel(void);
78
int channel_unref(channel_T *channel);
89
int free_unused_channels_contents(int copyID, int mask);
910
void free_unused_channels(int copyID, int mask);

src/proto/os_amiga.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int mch_get_shellsize(void);
3636
void mch_set_shellsize(void);
3737
void mch_new_shellsize(void);
3838
int mch_call_shell(char_u *cmd, int options);
39-
void mch_breakcheck(void);
39+
void mch_breakcheck(int force);
4040
long Chk_Abort(void);
4141
int mch_expandpath(garray_T *gap, char_u *pat, int flags);
4242
int mch_has_exp_wildcard(char_u *p);

src/proto/os_unix.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void mch_start_job(char **argv, job_T *job, jobopt_T *options);
6161
char *mch_job_status(job_T *job);
6262
int mch_stop_job(job_T *job, char_u *how);
6363
void mch_clear_job(job_T *job);
64-
void mch_breakcheck(void);
64+
void mch_breakcheck(int force);
6565
int mch_expandpath(garray_T *gap, char_u *path, int flags);
6666
int mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags);
6767
int mch_has_exp_wildcard(char_u *p);

src/proto/os_win32.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void mch_set_normal_colors(void);
4848
void mch_write(char_u *s, int len);
4949
void mch_delay(long msec, int ignoreinput);
5050
int mch_remove(char_u *name);
51-
void mch_breakcheck(void);
51+
void mch_breakcheck(int force);
5252
long_u mch_total_mem(int special);
5353
int mch_wrename(WCHAR *wold, WCHAR *wnew);
5454
int mch_rename(const char *pszOldFile, const char *pszNewFile);

src/proto/ui.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ int ui_get_shellsize(void);
1010
void ui_set_shellsize(int mustset);
1111
void ui_new_shellsize(void);
1212
void ui_breakcheck(void);
13+
void ui_breakcheck_force(int force);
1314
void clip_init(int can_use);
1415
void clip_update_selection(VimClipboard *clip);
1516
void clip_own_selection(VimClipboard *cbd);

0 commit comments

Comments
 (0)