Mercurial > vim
diff src/terminal.c @ 12007:64b822c4f7ae v8.0.0884
patch 8.0.0884: can't specify the wait time for term_wait()
commit https://github.com/vim/vim/commit/f3402b1b7f72d08e0357196902cce972b639bfd7
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 6 19:07:08 2017 +0200
patch 8.0.0884: can't specify the wait time for term_wait()
Problem: Can't specify the wait time for term_wait().
Solution: Add an otional second argument.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 06 Aug 2017 19:15:05 +0200 |
parents | 92a86fe8adc0 |
children | 0d9bfdb3f6f7 |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -36,7 +36,6 @@ * that buffer, attributes come from the scrollback buffer tl_scrollback. * * TODO: - * - Add argument to term_wait() for waiting time. * - For the scrollback buffer store lines in the buffer, only attributes in * tl_scrollback. * - When the job ends: @@ -2248,12 +2247,15 @@ f_term_wait(typval_T *argvars, typval_T } else { + long wait = 10L; + mch_check_messages(); parse_queued_messages(); - /* Wait for 10 msec for any channel I/O. */ - /* TODO: use delay from optional argument */ - ui_delay(10L, TRUE); + /* Wait for some time for any channel I/O. */ + if (argvars[1].v_type != VAR_UNKNOWN) + wait = get_tv_number(&argvars[1]); + ui_delay(wait, TRUE); mch_check_messages(); /* Flushing messages on channels is hopefully sufficient.