Mercurial > vim
comparison src/gui.c @ 13064:dc160dbdcfe2 v8.0.1407
patch 8.0.1407: GUI: CursorHold may trigger before 'updatetime'
commit https://github.com/vim/vim/commit/4af031dbc8d62f89c94072a406f6d2ec0e5200be
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Dec 19 10:02:43 2017 +0100
patch 8.0.1407: GUI: CursorHold may trigger before 'updatetime'
Problem: GUI: CursorHold may trigger before 'updatetime' when using timers.
Solution: Check that 'updatetime' has passed.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 19 Dec 2017 10:15:05 +0100 |
parents | 1bdc12630fc0 |
children | eee366f56b1a |
comparison
equal
deleted
inserted
replaced
13063:c1e813afafdd | 13064:dc160dbdcfe2 |
---|---|
2921 */ | 2921 */ |
2922 int | 2922 int |
2923 gui_wait_for_chars(long wtime, int tb_change_cnt) | 2923 gui_wait_for_chars(long wtime, int tb_change_cnt) |
2924 { | 2924 { |
2925 int retval; | 2925 int retval; |
2926 #if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) | |
2927 ELAPSED_TYPE start_tv; | |
2928 #endif | |
2926 | 2929 |
2927 #ifdef FEAT_MENU | 2930 #ifdef FEAT_MENU |
2928 /* | 2931 /* |
2929 * If we're going to wait a bit, update the menus and mouse shape for the | 2932 * If we're going to wait a bit, update the menus and mouse shape for the |
2930 * current State. | 2933 * current State. |
2949 gui_mch_start_blink(); | 2952 gui_mch_start_blink(); |
2950 retval = gui_wait_for_chars_or_timer(wtime); | 2953 retval = gui_wait_for_chars_or_timer(wtime); |
2951 gui_mch_stop_blink(); | 2954 gui_mch_stop_blink(); |
2952 return retval; | 2955 return retval; |
2953 } | 2956 } |
2957 | |
2958 #if defined(ELAPSED_FUNC) && defined(FEAT_AUTOCMD) | |
2959 ELAPSED_INIT(start_tv); | |
2960 #endif | |
2954 | 2961 |
2955 /* | 2962 /* |
2956 * While we are waiting indefinitely for a character, blink the cursor. | 2963 * While we are waiting indefinitely for a character, blink the cursor. |
2957 */ | 2964 */ |
2958 gui_mch_start_blink(); | 2965 gui_mch_start_blink(); |
2964 * wasn't used, put the K_CURSORHOLD key in the input buffer. | 2971 * wasn't used, put the K_CURSORHOLD key in the input buffer. |
2965 */ | 2972 */ |
2966 if (gui_wait_for_chars_or_timer(p_ut) == OK) | 2973 if (gui_wait_for_chars_or_timer(p_ut) == OK) |
2967 retval = OK; | 2974 retval = OK; |
2968 #ifdef FEAT_AUTOCMD | 2975 #ifdef FEAT_AUTOCMD |
2969 else if (trigger_cursorhold() && typebuf.tb_change_cnt == tb_change_cnt) | 2976 else if (trigger_cursorhold() |
2977 # ifdef ELAPSED_FUNC | |
2978 && ELAPSED_FUNC(start_tv) >= p_ut | |
2979 # endif | |
2980 && typebuf.tb_change_cnt == tb_change_cnt) | |
2970 { | 2981 { |
2971 char_u buf[3]; | 2982 char_u buf[3]; |
2972 | 2983 |
2973 /* Put K_CURSORHOLD in the input buffer. */ | 2984 /* Put K_CURSORHOLD in the input buffer. */ |
2974 buf[0] = CSI; | 2985 buf[0] = CSI; |