From f0a8ccff8fce91676b16ccf74971937466468d4c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 17 Dec 2020 23:29:27 -0500 Subject: vim-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) https://github.com/vim/vim/commit/57a6bf056715bd5c94d8047247615e39862424e7 --- src/nvim/ex_session.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 8d4f1a7cee..14dac9a126 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -613,21 +613,13 @@ static int makeopens(FILE *fd, char_u *dirnow) if ((ssop_flags & SSOP_TABPAGES)) { // 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++) { - const tabpage_T *const tp = find_tabpage(tabnr); - - if (tp == NULL) { // done all tab pages - break; - } - if (tabnr > 1 && put_line(fd, "tabnew") == FAIL) { + FOR_ALL_TABS(tp) { + if (tp->tp_next != NULL && put_line(fd, "tabnew") == FAIL) { return FAIL; } } - const int 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; } } -- cgit