diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-11-09 13:21:58 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-11-09 13:21:58 +0100 |
commit | a3f7e58bf846b28b347a5d5b96c2d829871bd212 (patch) | |
tree | d504fc8fc95d1f029d8a5790ca49ed13e8e08168 | |
parent | c9e9c7140994154bb4a29764491d42c001b24596 (diff) | |
download | vim-git-a3f7e58bf846b28b347a5d5b96c2d829871bd212.tar.gz |
patch 8.0.1276: key lost when window closed in exit callbackv8.0.1276
Problem: Typed key is lost when the terminal window is closed in exit
callback. (Gabriel Barta)
Solution: When the current window changes bail out of the wait loop. (closes
#2302)
-rw-r--r-- | src/misc2.c | 7 | ||||
-rw-r--r-- | src/terminal.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/misc2.c b/src/misc2.c index 4d4d947ff..63d9e81d6 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -6300,6 +6300,8 @@ has_non_ascii(char_u *s) void parse_queued_messages(void) { + win_T *old_curwin = curwin; + /* For Win32 mch_breakcheck() does not check for input, do it here. */ # if defined(WIN32) && defined(FEAT_JOB_CHANNEL) channel_handle_events(FALSE); @@ -6324,6 +6326,11 @@ parse_queued_messages(void) /* Check if any jobs have ended. */ job_check_ended(); # endif + + /* If the current window changed we need to bail out of the waiting loop. + * E.g. when a job exit callback closes the terminal window. */ + if (curwin != old_curwin) + ins_char_typebuf(K_IGNORE); } #endif diff --git a/src/terminal.c b/src/terminal.c index c6b3860d3..4c583977b 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -38,8 +38,6 @@ * in tl_scrollback are no longer used. * * TODO: - * - Termdebug: issue #2154 might be avoided by adding -quiet to gdb? - * patch by Christian, 2017 Oct 23. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) * - double click in Window toolbar starts Visual mode (but not always?). @@ -1581,8 +1579,12 @@ terminal_loop(int blocking) c = term_vgetc(); if (!term_use_loop()) + { /* job finished while waiting for a character */ + if (c != K_IGNORE) + vungetc(c); break; + } if (c == K_IGNORE) continue; diff --git a/src/version.c b/src/version.c index abac386c9..39bad6c4d 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1276, +/**/ 1275, /**/ 1274, |