To: vim_dev@googlegroups.com Subject: Patch 8.0.1276 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/misc2.c, src/terminal.c *** ../vim-8.0.1275/src/misc2.c 2017-10-28 21:08:38.987456954 +0200 --- src/misc2.c 2017-11-09 13:17:05.370497419 +0100 *************** *** 6300,6305 **** --- 6300,6307 ---- 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,6329 **** --- 6326,6336 ---- /* 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 *** ../vim-8.0.1275/src/terminal.c 2017-11-04 20:12:10.450599015 +0100 --- src/terminal.c 2017-11-09 13:14:35.023298831 +0100 *************** *** 38,45 **** * 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?). --- 38,43 ---- *************** *** 1581,1588 **** --- 1579,1590 ---- 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; *** ../vim-8.0.1275/src/version.c 2017-11-09 12:29:27.390551291 +0100 --- src/version.c 2017-11-09 13:11:58.376112415 +0100 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1276, /**/ -- Clothes make the man. Naked people have little or no influence on society. -- Mark Twain (Samuel Clemens) (1835-1910) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///