diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-04-08 21:54:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-08 21:54:18 +0200 |
commit | 2a6ccfccac189fecadbafa60a58b05815be3f09e (patch) | |
tree | 54819993173fd6f58e7d29d3d95d9fd8fe205da0 | |
parent | d48362fc8dcb88e4ded75a2d2726afff850c3cac (diff) | |
parent | e6101b4963020b0ce9362c70dc0608f2a3adb864 (diff) | |
download | rneovim-2a6ccfccac189fecadbafa60a58b05815be3f09e.tar.gz rneovim-2a6ccfccac189fecadbafa60a58b05815be3f09e.tar.bz2 rneovim-2a6ccfccac189fecadbafa60a58b05815be3f09e.zip |
Merge pull request #9868 from mhinz/vim-8.1.1118
vim-patch:8.1.1118: a couple of conditions are hard to understand
-rw-r--r-- | src/nvim/getchar.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index c29ef9f822..0020b57482 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2270,18 +2270,25 @@ static int vgetorpeek(int advance) // that has a <Nop> RHS. timedout = false; } + + long wait_time = 0; + + 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; + } + } + 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))); + typebuf.tb_buflen - typebuf.tb_off - typebuf.tb_len - 1, + wait_time); if (i != 0) pop_showcmd(); |