summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-04 20:13:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-04 20:13:09 +0200
commit652de23dc7abf6aa2721ccee7fe279b5cce8069c (patch)
treecec591d692dc674f9e2834169139777d46e5f97a /src
parent1cd4dc444ad260e4ff201152ecff2005dbd15410 (diff)
patch 8.1.1118: a couple of conditions are hard to understandv8.1.1118
Problem: A couple of conditions are hard to understand. Solution: Split the conditions into pieces. (Ozaki Kiichi, closes #3879)
Diffstat (limited to 'src')
-rw-r--r--src/getchar.c27
-rw-r--r--src/os_unix.c32
-rw-r--r--src/version.c2
3 files changed, 39 insertions, 22 deletions
diff --git a/src/getchar.c b/src/getchar.c
index e8926d4296..4011db1486 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2030,6 +2030,8 @@ vgetorpeek(int advance)
*/
for (;;)
{
+ long wait_time;
+
/*
* ui_breakcheck() is slow, don't use it too often when
* inside a mapping. But call it each time for typed
@@ -2828,18 +2830,25 @@ vgetorpeek(int advance)
// that has a <Nop> RHS.
timedout = FALSE;
+ if (advance)
+ {
+ if (typebuf.tb_len == 0
+ || !(p_timeout
+ || (p_ttimeout && keylen == KEYLEN_PART_KEY)))
+ // blocking wait
+ wait_time = -1L;
+ else if (keylen == KEYLEN_PART_KEY && p_ttm >= 0)
+ wait_time = p_ttm;
+ else
+ wait_time = p_tm;
+ }
+ else
+ wait_time = 0;
+
wait_tb_len = typebuf.tb_len;
c = inchar(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len,
typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1,
- !advance
- ? 0
- : ((typebuf.tb_len == 0
- || !(p_timeout || (p_ttimeout
- && keylen == KEYLEN_PART_KEY)))
- ? -1L
- : ((keylen == KEYLEN_PART_KEY && p_ttm >= 0)
- ? p_ttm
- : p_tm)));
+ wait_time);
#ifdef FEAT_CMDL_INFO
if (i != 0)
diff --git a/src/os_unix.c b/src/os_unix.c
index 8618499ea0..b5255bba1d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5607,19 +5607,25 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal)
close(fd_err[1]);
if (channel != NULL)
{
- int in_fd = use_file_for_in || use_null_for_in
- ? INVALID_FD : fd_in[1] < 0 ? pty_master_fd : fd_in[1];
- int out_fd = use_file_for_out || use_null_for_out
- ? INVALID_FD : fd_out[0] < 0 ? pty_master_fd : fd_out[0];
- /* When using pty_master_fd only set it for stdout, do not duplicate it
- * for stderr, it only needs to be read once. */
- int err_fd = use_out_for_err || use_file_for_err || use_null_for_err
- ? INVALID_FD
- : fd_err[0] >= 0
- ? fd_err[0]
- : (out_fd == pty_master_fd
- ? INVALID_FD
- : pty_master_fd);
+ int in_fd = INVALID_FD;
+ int out_fd = INVALID_FD;
+ int err_fd = INVALID_FD;
+
+ if (!(use_file_for_in || use_null_for_in))
+ in_fd = fd_in[1] >= 0 ? fd_in[1] : pty_master_fd;
+
+ if (!(use_file_for_out || use_null_for_out))
+ out_fd = fd_out[0] >= 0 ? fd_out[0] : pty_master_fd;
+
+ // When using pty_master_fd only set it for stdout, do not duplicate
+ // it for stderr, it only needs to be read once.
+ if (!(use_out_for_err || use_file_for_err || use_null_for_err))
+ {
+ if (fd_err[0] >= 0)
+ err_fd = fd_err[0];
+ else if (out_fd != pty_master_fd)
+ err_fd = pty_master_fd;
+ }
channel_set_pipes(channel, in_fd, out_fd, err_fd);
channel_set_job(channel, job, options);
diff --git a/src/version.c b/src/version.c
index 11849d92a5..14512b82ef 100644
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1118,
+/**/
1117,
/**/
1116,