aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-17 23:29:27 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-29 22:31:21 -0500
commitf0a8ccff8fce91676b16ccf74971937466468d4c (patch)
tree300ca8aae697ddbe462e2596f99332685e3b5ed4
parentc60f7c206402c8ab3f2fe5539953d410be2a322c (diff)
downloadrneovim-f0a8ccff8fce91676b16ccf74971937466468d4c.tar.gz
rneovim-f0a8ccff8fce91676b16ccf74971937466468d4c.tar.bz2
rneovim-f0a8ccff8fce91676b16ccf74971937466468d4c.zip
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
-rw-r--r--src/nvim/ex_session.c14
1 files changed, 3 insertions, 11 deletions
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;
}
}