diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-08-06 19:07:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-08-06 19:07:08 +0200 |
commit | f3402b1b7f72d08e0357196902cce972b639bfd7 (patch) | |
tree | c6dbed8b918d2664e460e05e482b4e02aeb9aac7 | |
parent | 1c864093f93b0066de25d6c0ddf03a6bc6b1c870 (diff) | |
download | vim-git-f3402b1b7f72d08e0357196902cce972b639bfd7.tar.gz |
patch 8.0.0884: can't specify the wait time for term_wait()v8.0.0884
Problem: Can't specify the wait time for term_wait().
Solution: Add an otional second argument.
-rw-r--r-- | runtime/doc/eval.txt | 6 | ||||
-rw-r--r-- | src/evalfunc.c | 2 | ||||
-rw-r--r-- | src/terminal.c | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 13 insertions, 7 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0bdf90281..6a2f8ef00 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2381,7 +2381,7 @@ term_list() List get the list of terminal buffers term_scrape({buf}, {row}) List get row of a terminal screen term_sendkeys({buf}, {keys}) none send keystrokes to a terminal term_start({cmd}, {options}) Job open a terminal window and run a job -term_wait({buf}) Number wait for screen to be updated +term_wait({buf} [, {time}]) Number wait for screen to be updated test_alloc_fail({id}, {countdown}, {repeat}) none make memory allocation fail test_autochdir() none enable 'autochdir' during startup @@ -8041,9 +8041,11 @@ term_start({cmd}, {options}) *term_start()* the command name. {only available when compiled with the |+terminal| feature} -term_wait({buf}) *term_wait()* +term_wait({buf} [, {time}]) *term_wait()* Wait for pending updates of {buf} to be handled. {buf} is used as with |term_getsize()|. + {time} is how long to wait for updates to arrive in msec. If + not set then 10 msec will be used. {only available when compiled with the |+terminal| feature} test_alloc_fail({id}, {countdown}, {repeat}) *test_alloc_fail()* diff --git a/src/evalfunc.c b/src/evalfunc.c index fde20584d..2377d1957 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -843,7 +843,7 @@ static struct fst {"term_scrape", 2, 2, f_term_scrape}, {"term_sendkeys", 2, 2, f_term_sendkeys}, {"term_start", 1, 2, f_term_start}, - {"term_wait", 1, 1, f_term_wait}, + {"term_wait", 1, 2, f_term_wait}, #endif {"test_alloc_fail", 3, 3, f_test_alloc_fail}, {"test_autochdir", 0, 0, f_test_autochdir}, diff --git a/src/terminal.c b/src/terminal.c index d300b1f64..0f70cc6a9 100644 --- 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 *rettv UNUSED) } 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. diff --git a/src/version.c b/src/version.c index e6bcfb5dd..e31811407 100644 --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 884, +/**/ 883, /**/ 882, |