Mercurial > vim
diff src/terminal.c @ 26598:b3ac5a4dc158 v8.2.3828
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Commit: https://github.com/vim/vim/commit/8103527da7f12ff21c2566222748518ee093432c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 16 18:02:07 2021 +0000
patch 8.2.3828: when opening a terminal from a timer first typed char is lost
Problem: when opening a terminal from a timer the first typed character
is lost. (Virginia Senioria)
Solution: When opening a terminal while waiting for a character put K_IGNORE
in the input buffer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Dec 2021 19:15:04 +0100 |
parents | 15764dc9a59d |
children | fc859aea8cec |
line wrap: on
line diff
--- a/src/terminal.c +++ b/src/terminal.c @@ -739,6 +739,23 @@ term_start( curwin->w_buffer = curbuf; ++curbuf->b_nwindows; } + else if (vgetc_busy +#ifdef FEAT_TIMERS + || timer_busy +#endif + || input_busy) + { + char_u ignore[4]; + + // When waiting for input need to return and possibly end up in + // terminal_loop() instead. + ignore[0] = K_SPECIAL; + ignore[1] = KS_EXTRA; + ignore[2] = KE_IGNORE; + ignore[3] = NUL; + ins_typebuf(ignore, REMAP_NONE, 0, TRUE, FALSE); + typebuf_was_filled = TRUE; + } } else {