event: No longer process K_EVENT automatically

Two new functions, `event_enable_deferred()`/`event_disable_deferred()` have to
be called by code that is capable of handling asynchronicity. User-dialog states
like "press ENTER to continue" or the swap file confirmation no longer will
generate K_EVENT.
This commit is contained in:
Thiago de Arruda
2014-11-21 15:34:18 -03:00
parent 230c935e73
commit f09a33bbc1
6 changed files with 42 additions and 25 deletions

View File

@@ -593,9 +593,17 @@ edit (
* Get a character for Insert mode. Ignore K_IGNORE.
*/
lastc = c; /* remember previous char for CTRL-D */
event_enable_deferred();
do {
c = safe_vgetc();
} while (c == K_IGNORE);
event_disable_deferred();
if (c == K_EVENT) {
c = lastc;
event_process();
continue;
}
/* Don't want K_CURSORHOLD for the second key, e.g., after CTRL-V. */
did_cursorhold = TRUE;
@@ -943,10 +951,6 @@ doESCkey:
did_cursorhold = TRUE;
break;
case K_EVENT:
event_process();
break;
case K_HOME: /* <Home> */
case K_KHOME:
case K_S_HOME: