summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-02 15:25:16 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-02 15:25:16 +0100
commitd98c0b63abd7b0e61a383669474abe96044615af (patch)
tree81409a98d3a6d7712373b57242a40171ab64d8de /src/terminal.c
parent3180fe6c6dc0728d21c6318b957022b029c234f0 (diff)
downloadvim-git-d98c0b63abd7b0e61a383669474abe96044615af.tar.gz
patch 8.2.0196: blocking commands for a finished job in a popup windowv8.2.0196
Problem: Blocking commands for a finished job in a popup window. Solution: Do not block commands if the job has finished. Adjust test.
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 7f92ab1a4..cbf8fe079 100644
--- 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.