diff options
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/getchar.c b/src/getchar.c index 93f896e1c3..736d72aa6b 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -164,6 +164,7 @@ static void map_free(mapblock_T **); static void validate_maphash(void); static void showmap(mapblock_T *mp, int local); static char_u *eval_map_expr(char_u *str, int c); +static bool is_user_input(int k); /* * Free and clear a buffer. @@ -2552,11 +2553,10 @@ fix_input_buffer ( * Don't replace K_SPECIAL when reading a script file. */ for (i = len; --i >= 0; ++p) { - if (p[0] == NUL || (p[0] == K_SPECIAL && !script - /* timeout may generate K_CURSORHOLD */ - && (i < 2 || p[1] != KS_EXTRA || p[2] != - (int)KE_CURSORHOLD) - )) { + if (p[0] == NUL + || (p[0] == K_SPECIAL + && !script + && (i < 2 || p[1] != KS_EXTRA || is_user_input(p[2])))) { memmove(p + 3, p + 1, (size_t)i); p[2] = K_THIRD(p[0]); p[1] = K_SECOND(p[0]); @@ -3816,6 +3816,11 @@ eval_map_expr ( return res; } +static bool is_user_input(int k) +{ + return k != (int)KE_EVENT && k != (int)KE_CURSORHOLD; +} + /* * Copy "p" to allocated memory, escaping K_SPECIAL and CSI so that the result * can be put in the typeahead buffer. |