mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 9.0.0708: :confirm does not work properly for a terminal buffer
Problem: :confirm does not work properly for a terminal buffer. Solution: Handle :confirm for a terminal buffer differently. (Yee Cheng Chin, closes #11312)
This commit is contained in:
committed by
Bram Moolenaar
parent
118c235112
commit
15b314ffbb
@@ -1651,6 +1651,25 @@ term_none_open(term_T *term)
|
||||
&& term->tl_job->jv_channel->ch_keep_open;
|
||||
}
|
||||
|
||||
//
|
||||
// Used to confirm whether we would like to kill a terminal.
|
||||
// Return OK when the user confirms to kill it.
|
||||
// Return FAIL if the user selects otherwise.
|
||||
//
|
||||
int
|
||||
term_confirm_stop(buf_T *buf)
|
||||
{
|
||||
char_u buff[DIALOG_MSG_SIZE];
|
||||
int ret;
|
||||
|
||||
dialog_msg(buff, _("Kill job in \"%s\"?"), buf_get_fname(buf));
|
||||
ret = vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1);
|
||||
if (ret == VIM_YES)
|
||||
return OK;
|
||||
else
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used when exiting: kill the job in "buf" if so desired.
|
||||
* Return OK when the job finished.
|
||||
@@ -1666,14 +1685,9 @@ term_try_stop_job(buf_T *buf)
|
||||
if ((how == NULL || *how == NUL)
|
||||
&& (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)))
|
||||
{
|
||||
char_u buff[DIALOG_MSG_SIZE];
|
||||
int ret;
|
||||
|
||||
dialog_msg(buff, _("Kill job in \"%s\"?"), buf_get_fname(buf));
|
||||
ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1);
|
||||
if (ret == VIM_YES)
|
||||
if (term_confirm_stop(buf) == OK)
|
||||
how = "kill";
|
||||
else if (ret == VIM_CANCEL)
|
||||
else
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user