ffname = eap->arg;
#ifdef FEAT_BROWSE
- if (cmdmod.browse)
+ if (cmdmod.browse && !exiting)
{
browse_file = do_browse(BROWSE_SAVE, (char_u *)_("Save As"), ffname,
NULL, NULL, NULL, curbuf);
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
* fails.
return OK;
ui_delay(10L, FALSE);
- mch_check_messages();
- parse_queued_messages();
+ term_flush_messages();
}
return FAIL;
}
for (term = first_term; term != NULL; term = next_term)
{
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;
did_one = TRUE;
ch_log(NULL, "term_wait(): waiting for channel to close");
while (buf->b_term != NULL && !buf->b_term->tl_channel_closed)
{
- mch_check_messages();
- parse_queued_messages();
+ term_flush_messages();
+
ui_delay(10L, FALSE);
if (!buf_valid(buf))
/* If the terminal is closed when the channel is closed the
* buffer disappears. */
break;
}
- mch_check_messages();
- parse_queued_messages();
+
+ term_flush_messages();
}
else
{
long wait = 10L;
- mch_check_messages();
- parse_queued_messages();
+ term_flush_messages();
/* Wait for some time for any channel I/O. */
if (argvars[1].v_type != VAR_UNKNOWN)
wait = tv_get_number(&argvars[1]);
ui_delay(wait, TRUE);
- mch_check_messages();
/* Flushing messages on channels is hopefully sufficient.
* TODO: is there a better way? */
- parse_queued_messages();
+ term_flush_messages();
}
}