diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-26 20:07:38 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-26 20:07:38 +0100 |
commit | d39e275b57493f9e25e1b62f84810571eee30cf4 (patch) | |
tree | 5b0b3dd06e22346bc2108a95ffeed31e00dc8472 /src/ex_docmd.c | |
parent | 6aba96dd5778b4201c9f5cb065d7669d3398e724 (diff) | |
download | vim-git-d39e275b57493f9e25e1b62f84810571eee30cf4.tar.gz |
patch 8.1.0829: when 'hidden' is set session creates extra buffersv8.1.0829
Problem: When 'hidden' is set session creates extra buffers.
Solution: Move :badd commands to the end. (Jason Franklin)
Diffstat (limited to 'src/ex_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 93fa69731..dcfdcd454 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11280,26 +11280,6 @@ makeopens( if (put_line(fd, "set shortmess=aoO") == FAIL) return FAIL; - /* Now put the other buffers into the buffer list */ - FOR_ALL_BUFFERS(buf) - { - if (!(only_save_windows && buf->b_nwindows == 0) - && !(buf->b_help && !(ssop_flags & SSOP_HELP)) -#ifdef FEAT_TERMINAL - /* skip terminal buffers: finished ones are not useful, others - * will be resurrected and result in a new buffer */ - && !bt_terminal(buf) -#endif - && buf->b_fname != NULL - && buf->b_p_bl) - { - if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L - : buf->b_wininfo->wi_fpos.lnum) < 0 - || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL) - return FAIL; - } - } - /* the global argument list */ if (ses_arglist(fd, "argglobal", &global_alist.al_ga, !(ssop_flags & SSOP_CURDIR), &ssop_flags) == FAIL) @@ -11515,6 +11495,29 @@ makeopens( if (restore_stal && put_line(fd, "set stal=1") == FAIL) return FAIL; + // Now put the remaining buffers into the buffer list. + // This is near the end, so that when 'hidden' is set we don't create extra + // buffers. If the buffer was already created with another command the + // ":badd" will have no effect. + FOR_ALL_BUFFERS(buf) + { + if (!(only_save_windows && buf->b_nwindows == 0) + && !(buf->b_help && !(ssop_flags & SSOP_HELP)) +#ifdef FEAT_TERMINAL + // Skip terminal buffers: finished ones are not useful, others + // will be resurrected and result in a new buffer. + && !bt_terminal(buf) +#endif + && buf->b_fname != NULL + && buf->b_p_bl) + { + if (fprintf(fd, "badd +%ld ", buf->b_wininfo == NULL ? 1L + : buf->b_wininfo->wi_fpos.lnum) < 0 + || ses_fname(fd, buf, &ssop_flags, TRUE) == FAIL) + return FAIL; + } + } + /* * Wipe out an empty unnamed buffer we started in. */ |