Mercurial > vim
changeset 11471:26525db57c4c v8.0.0619
patch 8.0.0619: GUI gets stuck if timer uses feedkeys()
commit https://github.com/vim/vim/commit/9472eec83c3f9c191814dc81dd82498c10b1fc9c
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 5 13:31:56 2017 +0200
patch 8.0.0619: GUI gets stuck if timer uses feedkeys()
Problem: In the GUI, when a timer uses feedkeys(), it still waits for an
event. (Raymond Ko)
Solution: Check tb_change_cnt in one more place.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 05 Jun 2017 13:45:04 +0200 |
parents | 9b1fcec1b32b |
children | 7b3e6e31fbb6 |
files | src/gui.c src/version.c |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gui.c +++ b/src/gui.c @@ -2849,6 +2849,10 @@ gui_insert_lines(int row, int count) } } +/* + * Returns OK if a character was found to be available within the given time, + * or FAIL otherwise. + */ static int gui_wait_for_chars_or_timer(long wtime) { @@ -2869,16 +2873,16 @@ gui_wait_for_chars_or_timer(long wtime) if (typebuf.tb_change_cnt != tb_change_cnt) { /* timer may have used feedkeys() */ - return FALSE; + return FAIL; } if (due_time <= 0 || (wtime > 0 && due_time > remaining)) due_time = remaining; if (gui_mch_wait_for_chars(due_time)) - return TRUE; + return OK; if (wtime > 0) remaining -= due_time; } - return FALSE; + return FAIL; #else return gui_mch_wait_for_chars(wtime); #endif @@ -2896,6 +2900,7 @@ gui_wait_for_chars_or_timer(long wtime) gui_wait_for_chars(long wtime) { int retval; + int tb_change_cnt = typebuf.tb_change_cnt; #ifdef FEAT_MENU /* @@ -2953,7 +2958,7 @@ gui_wait_for_chars(long wtime) } #endif - if (retval == FAIL) + if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt) { /* Blocking wait. */ before_blocking();