0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0858: can exit while a terminal is still running a job

Problem:    Can exit while a terminal is still running a job.
Solution:   Consider a buffer with a running job like a changed file.
This commit is contained in:
Bram Moolenaar
2017-08-03 22:44:55 +02:00
parent 620d064b0b
commit eb44a68b42
11 changed files with 55 additions and 50 deletions

View File

@@ -36,7 +36,6 @@
* that buffer, attributes come from the scrollback buffer tl_scrollback.
*
* TODO:
* - don't allow exiting Vim when a terminal is still running a job
* - MS-Windows: no redraw for 'updatetime' #1915
* - in bash mouse clicks are inserting characters.
* - mouse scroll: when over other window, scroll that window.
@@ -284,11 +283,16 @@ term_start(char_u *cmd, jobopt_T *opt)
}
curbuf->b_fname = curbuf->b_ffname;
set_string_option_direct((char_u *)"buftype", -1,
(char_u *)"terminal", OPT_FREE|OPT_LOCAL, 0);
/* Mark the buffer as not modifiable. It can only be made modifiable after
* the job finished. */
curbuf->b_p_ma = FALSE;
set_string_option_direct((char_u *)"buftype", -1,
(char_u *)"terminal", OPT_FREE|OPT_LOCAL, 0);
/* Set 'bufhidden' to "hide": allow closing the window. */
set_string_option_direct((char_u *)"bufhidden", -1,
(char_u *)"hide", OPT_FREE|OPT_LOCAL, 0);
set_term_and_win_size(term);
setup_job_options(opt, term->tl_rows, term->tl_cols);