0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1592: may start file dialog while exiting

Problem:    May start file dialog while exiting.
Solution:   Ignore the "browse" modifier when exiting. (Ozaki Kiichi,
            closes #4582
This commit is contained in:
Bram Moolenaar
2019-06-25 06:50:31 +02:00
parent 7d491c4253
commit 5c381eb9e7
3 changed files with 21 additions and 12 deletions

View File

@@ -3186,7 +3186,7 @@ do_write(exarg_T *eap)
ffname = eap->arg; ffname = eap->arg;
#ifdef FEAT_BROWSE #ifdef FEAT_BROWSE
if (cmdmod.browse) if (cmdmod.browse && !exiting)
{ {
browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname, browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname,
NULL, NULL, NULL, curbuf); NULL, NULL, NULL, curbuf);

View File

@@ -357,6 +357,16 @@ setup_job_options(jobopt_T *opt, int rows, int cols)
opt->jo_term_cols = cols; opt->jo_term_cols = cols;
} }
/*
* Flush messages on channels.
*/
static void
term_flush_messages()
{
mch_check_messages();
parse_queued_messages();
}
/* /*
* Close a terminal buffer (and its window). Used when creating the terminal * Close a terminal buffer (and its window). Used when creating the terminal
* fails. * fails.
@@ -1455,8 +1465,7 @@ term_try_stop_job(buf_T *buf)
return OK; return OK;
ui_delay(10L, FALSE); ui_delay(10L, FALSE);
mch_check_messages(); term_flush_messages();
parse_queued_messages();
} }
return FAIL; return FAIL;
} }
@@ -3064,7 +3073,7 @@ term_channel_closed(channel_T *ch)
for (term = first_term; term != NULL; term = next_term) for (term = first_term; term != NULL; term = next_term)
{ {
next_term = term->tl_next; next_term = term->tl_next;
if (term->tl_job == ch->ch_job) if (term->tl_job == ch->ch_job && !term->tl_channel_closed)
{ {
term->tl_channel_closed = TRUE; term->tl_channel_closed = TRUE;
did_one = TRUE; did_one = TRUE;
@@ -5628,33 +5637,31 @@ f_term_wait(typval_T *argvars, typval_T *rettv UNUSED)
ch_log(NULL, "term_wait(): waiting for channel to close"); ch_log(NULL, "term_wait(): waiting for channel to close");
while (buf->b_term != NULL && !buf->b_term->tl_channel_closed) while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
{ {
mch_check_messages(); term_flush_messages();
parse_queued_messages();
ui_delay(10L, FALSE); ui_delay(10L, FALSE);
if (!buf_valid(buf)) if (!buf_valid(buf))
/* If the terminal is closed when the channel is closed the /* If the terminal is closed when the channel is closed the
* buffer disappears. */ * buffer disappears. */
break; break;
} }
mch_check_messages();
parse_queued_messages(); term_flush_messages();
} }
else else
{ {
long wait = 10L; long wait = 10L;
mch_check_messages(); term_flush_messages();
parse_queued_messages();
/* Wait for some time for any channel I/O. */ /* Wait for some time for any channel I/O. */
if (argvars[1].v_type != VAR_UNKNOWN) if (argvars[1].v_type != VAR_UNKNOWN)
wait = tv_get_number(&argvars[1]); wait = tv_get_number(&argvars[1]);
ui_delay(wait, TRUE); ui_delay(wait, TRUE);
mch_check_messages();
/* Flushing messages on channels is hopefully sufficient. /* Flushing messages on channels is hopefully sufficient.
* TODO: is there a better way? */ * TODO: is there a better way? */
parse_queued_messages(); term_flush_messages();
} }
} }

View File

@@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1592,
/**/ /**/
1591, 1591,
/**/ /**/