0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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.
This commit is contained in:
Bram Moolenaar 2017-06-05 13:31:56 +02:00
parent bb7943b792
commit 9472eec83c
2 changed files with 11 additions and 4 deletions

View File

@ -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 static int
gui_wait_for_chars_or_timer(long wtime) 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) if (typebuf.tb_change_cnt != tb_change_cnt)
{ {
/* timer may have used feedkeys() */ /* timer may have used feedkeys() */
return FALSE; return FAIL;
} }
if (due_time <= 0 || (wtime > 0 && due_time > remaining)) if (due_time <= 0 || (wtime > 0 && due_time > remaining))
due_time = remaining; due_time = remaining;
if (gui_mch_wait_for_chars(due_time)) if (gui_mch_wait_for_chars(due_time))
return TRUE; return OK;
if (wtime > 0) if (wtime > 0)
remaining -= due_time; remaining -= due_time;
} }
return FALSE; return FAIL;
#else #else
return gui_mch_wait_for_chars(wtime); return gui_mch_wait_for_chars(wtime);
#endif #endif
@ -2896,6 +2900,7 @@ gui_wait_for_chars_or_timer(long wtime)
gui_wait_for_chars(long wtime) gui_wait_for_chars(long wtime)
{ {
int retval; int retval;
int tb_change_cnt = typebuf.tb_change_cnt;
#ifdef FEAT_MENU #ifdef FEAT_MENU
/* /*
@ -2953,7 +2958,7 @@ gui_wait_for_chars(long wtime)
} }
#endif #endif
if (retval == FAIL) if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt)
{ {
/* Blocking wait. */ /* Blocking wait. */
before_blocking(); before_blocking();

View File

@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
619,
/**/ /**/
618, 618,
/**/ /**/