]> granicus.if.org Git - vim/commitdiff
patch 8.0.1276: key lost when window closed in exit callback v8.0.1276
authorBram Moolenaar <Bram@vim.org>
Thu, 9 Nov 2017 12:21:58 +0000 (13:21 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 9 Nov 2017 12:21:58 +0000 (13:21 +0100)
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)

src/misc2.c
src/terminal.c
src/version.c

index 4d4d947ff0974ed7157adab6673338c0febf84ec..63d9e81d69c1fd1a0d90b979e6b6c1d2f696d973 100644 (file)
@@ -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
 
index c6b3860d36e887d745d706e42f13a650384596d8..4c583977b9227b8dc604b5bc0f496c30dd942744 100644 (file)
@@ -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;
 
index abac386c93653e3c110ee3e13f0bf77b15adac85..39bad6c4d3367f20d9c66cfbdb6be67cdd338f4c 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1276,
 /**/
     1275,
 /**/