]> granicus.if.org Git - vim/commitdiff
patch 8.1.0790: code for creating tabpages in session is too complex v8.1.0790
authorBram Moolenaar <Bram@vim.org>
Tue, 22 Jan 2019 20:27:13 +0000 (21:27 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 22 Jan 2019 20:27:13 +0000 (21:27 +0100)
Problem:    Code for creating tabpages in session is too complex.
Solution:   Simplify the code. (Jason Franklin)

src/ex_docmd.c
src/version.c

index 387d26d15729c84ca8dba5ee1f50ed9243d68b3a..62f507c2b4aab3434cf73b8244e18ddf3033784e 100644 (file)
@@ -11401,26 +11401,14 @@ makeopens(
     tab_topframe = topframe;
     if ((ssop_flags & SSOP_TABPAGES))
     {
-       int     num_tabs;
+       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 (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)
+       // 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)
index 364739738b219bf2732eac9d05fe15f608528d69..8d2050f62282586e4123b580d1a96a0d25f1e6ff 100644 (file)
@@ -791,6 +791,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    790,
 /**/
     789,
 /**/