Mercurial > vim
changeset 15565:30d4a5f547c7 v8.1.0790
patch 8.1.0790: code for creating tabpages in session is too complex
commit https://github.com/vim/vim/commit/57a6bf056715bd5c94d8047247615e39862424e7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 22 21:27:13 2019 +0100
patch 8.1.0790: code for creating tabpages in session is too complex
Problem: Code for creating tabpages in session is too complex.
Solution: Simplify the code. (Jason Franklin)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Jan 2019 21:30:04 +0100 |
parents | acb0995b8a2c |
children | edc9fc7cd03b |
files | src/ex_docmd.c src/version.c |
diffstat | 2 files changed, 9 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11401,26 +11401,14 @@ makeopens( tab_topframe = topframe; if ((ssop_flags & SSOP_TABPAGES)) { - int num_tabs; - - /* - * Similar to ses_win_rec() below, populate the tab pages first so - * later local options won't be copied to the new tabs. - */ - for (tabnr = 1; ; ++tabnr) - { - tabpage_T *tp = find_tabpage(tabnr); - - if (tp == NULL) /* done all tab pages */ - break; - - if (tabnr > 1 && put_line(fd, "tabnew") == FAIL) + tabpage_T *tp; + + // Similar to ses_win_rec() below, populate the tab pages first so + // later local options won't be copied to the new tabs. + FOR_ALL_TABPAGES(tp) + if (tp->tp_next != NULL && put_line(fd, "tabnew") == FAIL) return FAIL; - } - - num_tabs = tabnr - 1; - if (num_tabs > 1 && (fprintf(fd, "tabnext -%d", num_tabs - 1) < 0 - || put_eol(fd) == FAIL)) + if (first_tabpage->tp_next != NULL && put_line(fd, "tabrewind") == FAIL) return FAIL; } for (tabnr = 1; ; ++tabnr)