mirror of
https://github.com/neovim/neovim.git
synced 2025-09-26 21:18:34 +00:00
Define special key for asynchronous events
K_EVENT/KE_EVENT are used to signal any loop that reads user input(scattered across normal.c edit.c , ex_getln.c and message.c) of asynchronous events that were not initiated by the user. Representing non-user asynchronous events as special keys has the following advantages: - We reuse the normal vim redrawing code. As far as the rest of the code in edit.c/normal.c is concerned, it's just the user pressing another key. - Assume less about vim tolerance for "out-of-band" modifications to its internal state. - We still have a very complex codebase and it's hard to predict what bugs may be introduced by these changes. With this we implement asynchronicity in a way that will be more "natural" to the editor and has less chance of causing unpredictable behavior. As the code is refactored, we will be able to treat user input as an 'event type' and not the other way around(With this we are treating arbitrary events as a special case of user input).
This commit is contained in:
@@ -270,6 +270,7 @@ enum key_extra {
|
||||
, KE_NOP /* doesn't do something */
|
||||
, KE_FOCUSGAINED /* focus gained */
|
||||
, KE_FOCUSLOST /* focus lost */
|
||||
, KE_EVENT // event
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -467,6 +468,7 @@ enum key_extra {
|
||||
#define K_FOCUSLOST TERMCAP2KEY(KS_EXTRA, KE_FOCUSLOST)
|
||||
|
||||
#define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD)
|
||||
#define K_EVENT TERMCAP2KEY(KS_EXTRA, KE_EVENT)
|
||||
|
||||
/* Bits for modifier mask */
|
||||
/* 0x01 cannot be used, because the modifier must be 0x02 or higher */
|
||||
|
Reference in New Issue
Block a user