diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-04-04 20:13:09 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-04-04 20:13:09 +0200 |
commit | 652de23dc7abf6aa2721ccee7fe279b5cce8069c (patch) | |
tree | cec591d692dc674f9e2834169139777d46e5f97a /src/getchar.c | |
parent | 1cd4dc444ad260e4ff201152ecff2005dbd15410 (diff) | |
download | vim-git-652de23dc7abf6aa2721ccee7fe279b5cce8069c.tar.gz |
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/getchar.c')
-rw-r--r-- | src/getchar.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/getchar.c b/src/getchar.c index e8926d429..4011db148 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) |