Mercurial > vim
comparison src/gui.c @ 8947:c07caeb90a35 v7.4.1759
commit https://github.com/vim/vim/commit/40b1b5443c88fab77f1f7c6f9e801f7ffdb7e0a8
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 20 20:18:23 2016 +0200
patch 7.4.1759
Problem: When using feedkeys() in a timer the inserted characters are not
used right away.
Solution: Break the wait loop when characters have been added to typebuf.
use this for testing CursorHoldI.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 20 Apr 2016 20:30:07 +0200 |
parents | 24b43dd167eb |
children | 4981cd0802c7 |
comparison
equal
deleted
inserted
replaced
8946:0f9988d6fa49 | 8947:c07caeb90a35 |
---|---|
2853 gui_wait_for_chars_or_timer(long wtime) | 2853 gui_wait_for_chars_or_timer(long wtime) |
2854 { | 2854 { |
2855 #ifdef FEAT_TIMERS | 2855 #ifdef FEAT_TIMERS |
2856 int due_time; | 2856 int due_time; |
2857 long remaining = wtime; | 2857 long remaining = wtime; |
2858 int tb_change_cnt = typebuf.tb_change_cnt; | |
2858 | 2859 |
2859 /* When waiting very briefly don't trigger timers. */ | 2860 /* When waiting very briefly don't trigger timers. */ |
2860 if (wtime >= 0 && wtime < 10L) | 2861 if (wtime >= 0 && wtime < 10L) |
2861 return gui_mch_wait_for_chars(wtime); | 2862 return gui_mch_wait_for_chars(wtime); |
2862 | 2863 |
2863 while (wtime < 0 || remaining > 0) | 2864 while (wtime < 0 || remaining > 0) |
2864 { | 2865 { |
2865 /* Trigger timers and then get the time in wtime until the next one is | 2866 /* Trigger timers and then get the time in wtime until the next one is |
2866 * due. Wait up to that time. */ | 2867 * due. Wait up to that time. */ |
2867 due_time = check_due_timer(); | 2868 due_time = check_due_timer(); |
2869 if (typebuf.tb_change_cnt != tb_change_cnt) | |
2870 { | |
2871 /* timer may have used feedkeys() */ | |
2872 return FALSE; | |
2873 } | |
2868 if (due_time <= 0 || (wtime > 0 && due_time > remaining)) | 2874 if (due_time <= 0 || (wtime > 0 && due_time > remaining)) |
2869 due_time = remaining; | 2875 due_time = remaining; |
2870 if (gui_mch_wait_for_chars(due_time)) | 2876 if (gui_mch_wait_for_chars(due_time)) |
2871 return TRUE; | 2877 return TRUE; |
2872 if (wtime > 0) | 2878 if (wtime > 0) |