Mercurial > vim
comparison src/terminal.c @ 30747:58592b6af4e2 v9.0.0708
patch 9.0.0708: :confirm does not work properly for a terminal buffer
Commit: https://github.com/vim/vim/commit/15b314ffbb93f934b72cb71aa8f881caea026256
Author: Yee Cheng Chin <ychin.git@gmail.com>
Date: Sun Oct 9 18:53:32 2022 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 09 Oct 2022 20:00:04 +0200 |
parents | 101f08b49ed3 |
children | c7983f593fa7 |
comparison
equal
deleted
inserted
replaced
30746:7497bddb55b3 | 30747:58592b6af4e2 |
---|---|
1649 && term->tl_job != NULL | 1649 && term->tl_job != NULL |
1650 && channel_is_open(term->tl_job->jv_channel) | 1650 && channel_is_open(term->tl_job->jv_channel) |
1651 && term->tl_job->jv_channel->ch_keep_open; | 1651 && term->tl_job->jv_channel->ch_keep_open; |
1652 } | 1652 } |
1653 | 1653 |
1654 // | |
1655 // Used to confirm whether we would like to kill a terminal. | |
1656 // Return OK when the user confirms to kill it. | |
1657 // Return FAIL if the user selects otherwise. | |
1658 // | |
1659 int | |
1660 term_confirm_stop(buf_T *buf) | |
1661 { | |
1662 char_u buff[DIALOG_MSG_SIZE]; | |
1663 int ret; | |
1664 | |
1665 dialog_msg(buff, _("Kill job in \"%s\"?"), buf_get_fname(buf)); | |
1666 ret = vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1); | |
1667 if (ret == VIM_YES) | |
1668 return OK; | |
1669 else | |
1670 return FAIL; | |
1671 } | |
1672 | |
1654 /* | 1673 /* |
1655 * Used when exiting: kill the job in "buf" if so desired. | 1674 * Used when exiting: kill the job in "buf" if so desired. |
1656 * Return OK when the job finished. | 1675 * Return OK when the job finished. |
1657 * Return FAIL when the job is still running. | 1676 * Return FAIL when the job is still running. |
1658 */ | 1677 */ |
1664 | 1683 |
1665 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) | 1684 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) |
1666 if ((how == NULL || *how == NUL) | 1685 if ((how == NULL || *how == NUL) |
1667 && (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))) | 1686 && (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM))) |
1668 { | 1687 { |
1669 char_u buff[DIALOG_MSG_SIZE]; | 1688 if (term_confirm_stop(buf) == OK) |
1670 int ret; | |
1671 | |
1672 dialog_msg(buff, _("Kill job in \"%s\"?"), buf_get_fname(buf)); | |
1673 ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); | |
1674 if (ret == VIM_YES) | |
1675 how = "kill"; | 1689 how = "kill"; |
1676 else if (ret == VIM_CANCEL) | 1690 else |
1677 return FAIL; | 1691 return FAIL; |
1678 } | 1692 } |
1679 #endif | 1693 #endif |
1680 if (how == NULL || *how == NUL) | 1694 if (how == NULL || *how == NUL) |
1681 return FAIL; | 1695 return FAIL; |