comparison src/gui.c @ 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 f4d1fad4ac00
children 578df034735d
comparison
equal deleted inserted replaced
11470:9b1fcec1b32b 11471:26525db57c4c
2847 gui.cursor_is_valid = FALSE; 2847 gui.cursor_is_valid = FALSE;
2848 } 2848 }
2849 } 2849 }
2850 } 2850 }
2851 2851
2852 /*
2853 * Returns OK if a character was found to be available within the given time,
2854 * or FAIL otherwise.
2855 */
2852 static int 2856 static int
2853 gui_wait_for_chars_or_timer(long wtime) 2857 gui_wait_for_chars_or_timer(long wtime)
2854 { 2858 {
2855 #ifdef FEAT_TIMERS 2859 #ifdef FEAT_TIMERS
2856 int due_time; 2860 int due_time;
2867 * due. Wait up to that time. */ 2871 * due. Wait up to that time. */
2868 due_time = check_due_timer(); 2872 due_time = check_due_timer();
2869 if (typebuf.tb_change_cnt != tb_change_cnt) 2873 if (typebuf.tb_change_cnt != tb_change_cnt)
2870 { 2874 {
2871 /* timer may have used feedkeys() */ 2875 /* timer may have used feedkeys() */
2872 return FALSE; 2876 return FAIL;
2873 } 2877 }
2874 if (due_time <= 0 || (wtime > 0 && due_time > remaining)) 2878 if (due_time <= 0 || (wtime > 0 && due_time > remaining))
2875 due_time = remaining; 2879 due_time = remaining;
2876 if (gui_mch_wait_for_chars(due_time)) 2880 if (gui_mch_wait_for_chars(due_time))
2877 return TRUE; 2881 return OK;
2878 if (wtime > 0) 2882 if (wtime > 0)
2879 remaining -= due_time; 2883 remaining -= due_time;
2880 } 2884 }
2881 return FALSE; 2885 return FAIL;
2882 #else 2886 #else
2883 return gui_mch_wait_for_chars(wtime); 2887 return gui_mch_wait_for_chars(wtime);
2884 #endif 2888 #endif
2885 } 2889 }
2886 2890
2894 */ 2898 */
2895 int 2899 int
2896 gui_wait_for_chars(long wtime) 2900 gui_wait_for_chars(long wtime)
2897 { 2901 {
2898 int retval; 2902 int retval;
2903 int tb_change_cnt = typebuf.tb_change_cnt;
2899 2904
2900 #ifdef FEAT_MENU 2905 #ifdef FEAT_MENU
2901 /* 2906 /*
2902 * If we're going to wait a bit, update the menus and mouse shape for the 2907 * If we're going to wait a bit, update the menus and mouse shape for the
2903 * current State. 2908 * current State.
2951 2956
2952 retval = OK; 2957 retval = OK;
2953 } 2958 }
2954 #endif 2959 #endif
2955 2960
2956 if (retval == FAIL) 2961 if (retval == FAIL && typebuf.tb_change_cnt == tb_change_cnt)
2957 { 2962 {
2958 /* Blocking wait. */ 2963 /* Blocking wait. */
2959 before_blocking(); 2964 before_blocking();
2960 retval = gui_wait_for_chars_or_timer(-1L); 2965 retval = gui_wait_for_chars_or_timer(-1L);
2961 } 2966 }