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

patch 8.1.1457: cannot reuse a buffer when loading a screen dump

Problem:    Cannot reuse a buffer when loading a screen dump.
Solution:   Add the "bufnr" option.
This commit is contained in:
Bram Moolenaar
2019-06-03 21:14:59 +02:00
parent 98fb65cb05
commit 87abab92f5
6 changed files with 77 additions and 3 deletions

View File

@@ -4616,7 +4616,7 @@ get_separator(int text_width, char_u *fname)
term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
{
jobopt_T opt;
buf_T *buf;
buf_T *buf = NULL;
char_u buf1[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
char_u *fname1;
@@ -4671,7 +4671,27 @@ term_load_dump(typval_T *argvars, typval_T *rettv, int do_diff)
}
}
buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB);
if (opt.jo_bufnr_buf != NULL)
{
win_T *wp = buf_jump_open_win(opt.jo_bufnr_buf);
// With "bufnr" argument: enter the window with this buffer and make it
// empty.
if (wp == NULL)
semsg(_(e_invarg2), "bufnr");
else
{
buf = curbuf;
while (!(curbuf->b_ml.ml_flags & ML_EMPTY))
ml_delete((linenr_T)1, FALSE);
ga_clear(&curbuf->b_term->tl_scrollback);
redraw_later(NOT_VALID);
}
}
else
// Create a new terminal window.
buf = term_start(&argvars[0], NULL, &opt, TERM_START_NOJOB);
if (buf != NULL && buf->b_term != NULL)
{
int i;