diff src/terminal.c @ 19275:2142fb624658 v8.2.0196

patch 8.2.0196: blocking commands for a finished job in a popup window Commit: https://github.com/vim/vim/commit/d98c0b63abd7b0e61a383669474abe96044615af Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 2 15:25:16 2020 +0100 patch 8.2.0196: blocking commands for a finished job in a popup window Problem: Blocking commands for a finished job in a popup window. Solution: Do not block commands if the job has finished. Adjust test.
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Feb 2020 15:30:04 +0100
parents ce8c47ed54e5
children 734ca70c1f12
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -3260,6 +3260,29 @@ term_after_channel_closed(term_T *term)
     return FALSE;
 }
 
+#if defined(FEAT_PROP_POPUP) || defined(PROTO)
+/*
+ * If the current window is a terminal in a popup window and the job has
+ * finished, close the popup window and to back to the previous window.
+ * Otherwise return FAIL.
+ */
+    int
+may_close_term_popup(void)
+{
+    if (popup_is_popup(curwin) && curbuf->b_term != NULL
+					  && !term_job_running(curbuf->b_term))
+    {
+	win_T *pwin = curwin;
+
+	if (win_valid(prevwin))
+	    win_enter(prevwin, FALSE);
+	popup_close_with_retval(pwin, 0);
+	return OK;
+    }
+    return FAIL;
+}
+#endif
+
 /*
  * Called when a channel has been closed.
  * If this was a channel for a terminal window then finish it up.