diff options
author | Yee Cheng Chin <ychin.git@gmail.com> | 2022-10-09 18:53:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-09 18:53:32 +0100 |
commit | 15b314ffbb93f934b72cb71aa8f881caea026256 (patch) | |
tree | cffce54dd07078c4d6407e7e06a2823f945e6ef6 /src/ex_docmd.c | |
parent | 118c235112854f34182d968613d7fe98be3b290b (diff) |
patch 9.0.0708: :confirm does not work properly for a terminal bufferv9.0.0708
Problem: :confirm does not work properly for a terminal buffer.
Solution: Handle :confirm for a terminal buffer differently. (Yee Cheng
Chin, closes #11312)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 8ca5ede46b..f5b3980465 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -6061,13 +6061,27 @@ ex_win_close( #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if ((p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) && p_write) { - bufref_T bufref; +# ifdef FEAT_TERMINAL + if (term_job_running(buf->b_term)) + { + if (term_confirm_stop(buf) == FAIL) + return; + // Manually kill the terminal here because this command will + // hide it otherwise. + free_terminal(buf); + need_hide = FALSE; + } + else +# endif + { + bufref_T bufref; - set_bufref(&bufref, buf); - dialog_changed(buf, FALSE); - if (bufref_valid(&bufref) && bufIsChanged(buf)) - return; - need_hide = FALSE; + set_bufref(&bufref, buf); + dialog_changed(buf, FALSE); + if (bufref_valid(&bufref) && bufIsChanged(buf)) + return; + need_hide = FALSE; + } } else #endif |