4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: When creating a session file and there are several tab pages and
12 some windows have a local directory a short file name may be used
13 when it's not valid. (Marius Roets)
14 A session with multiple tab pages may result in "No Name" buffers.
16 Solution: Don't enter tab pages when going through the list, only use a
17 pointer to the first window in each tab page.
18 Use "tabedit" instead of "tabnew | edit" when possible.
22 *** ../vim-7.0.146/src/ex_docmd.c Sun Sep 10 21:05:39 2006
23 --- src/ex_docmd.c Tue Oct 24 12:55:11 2006
29 ! static int ses_winsizes __ARGS((FILE *fd, int restore_size));
30 static int ses_win_rec __ARGS((FILE *fd, frame_T *fr));
31 static frame_T *ses_skipframe __ARGS((frame_T *fr));
32 static int ses_do_frame __ARGS((frame_T *fr));
37 ! static int ses_winsizes __ARGS((FILE *fd, int restore_size,
38 ! win_T *tab_firstwin));
39 static int ses_win_rec __ARGS((FILE *fd, frame_T *fr));
40 static frame_T *ses_skipframe __ARGS((frame_T *fr));
41 static int ses_do_frame __ARGS((frame_T *fr));
46 win_T *edited_win = NULL;
47 - tabpage_T *old_curtab = curtab;
50 if (ssop_flags & SSOP_BUFFERS)
51 only_save_windows = FALSE; /* Save ALL buffers */
55 win_T *edited_win = NULL;
57 + win_T *tab_firstwin;
59 if (ssop_flags & SSOP_BUFFERS)
60 only_save_windows = FALSE; /* Save ALL buffers */
64 * May repeat putting Windows for each tab, when "tabpages" is in
67 for (tabnr = 1; ; ++tabnr)
69 if ((ssop_flags & SSOP_TABPAGES))
71 ! goto_tabpage(tabnr);
72 ! if (tabnr > 1 && put_line(fd, "tabnew") == FAIL)
79 * May repeat putting Windows for each tab, when "tabpages" is in
81 + * Don't use goto_tabpage(), it may change directory and trigger
84 + tab_firstwin = firstwin; /* first window in tab page "tabnr" */
85 for (tabnr = 1; ; ++tabnr)
87 + int need_tabnew = FALSE;
89 if ((ssop_flags & SSOP_TABPAGES))
91 ! tabpage_T *tp = find_tabpage(tabnr);
94 ! break; /* done all tab pages */
96 ! tab_firstwin = firstwin;
98 ! tab_firstwin = tp->tp_firstwin;
100 ! need_tabnew = TRUE;
106 * is aborted we don't end up with a number of useless windows.
107 * This may have side effects! (e.g., compressed or network file).
109 ! for (wp = firstwin; wp != NULL; wp = wp->w_next)
112 && wp->w_buffer->b_ffname != NULL
114 * is aborted we don't end up with a number of useless windows.
115 * This may have side effects! (e.g., compressed or network file).
117 ! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
120 && wp->w_buffer->b_ffname != NULL
126 ! if (fputs("edit ", fd) < 0
127 || ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
129 if (!wp->w_arg_idx_invalid)
136 * Save current window layout.
142 ! if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
143 || ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
145 + need_tabnew = FALSE;
146 if (!wp->w_arg_idx_invalid)
152 + /* If no file got edited create an empty tab page. */
153 + if (need_tabnew && put_line(fd, "tabnew") == FAIL)
157 * Save current window layout.
161 * Remember the window number of the current window after restoring.
164 ! for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
169 * Remember the window number of the current window after restoring.
172 ! for (wp = tab_firstwin; wp != NULL; wp = W_NEXT(wp))
179 if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
181 ! if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL)
185 * Restore the view of the window (options, file, cursor, etc.).
187 ! for (wp = firstwin; wp != NULL; wp = wp->w_next)
193 if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
195 ! if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
199 * Restore the view of the window (options, file, cursor, etc.).
201 ! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
207 * Restore window sizes again after jumping around in windows, because
208 * the current window has a minimum size while others may not.
210 ! if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL)
213 /* Don't continue in another tab page when doing only the current one
214 * or when at the last tab page. */
215 ! if (!(ssop_flags & SSOP_TABPAGES) || curtab->tp_next == NULL)
219 if (ssop_flags & SSOP_TABPAGES)
221 - if (valid_tabpage(old_curtab))
222 - goto_tabpage_tp(old_curtab);
223 if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
224 || put_eol(fd) == FAIL)
227 * Restore window sizes again after jumping around in windows, because
228 * the current window has a minimum size while others may not.
230 ! if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
233 /* Don't continue in another tab page when doing only the current one
234 * or when at the last tab page. */
235 ! if (!(ssop_flags & SSOP_TABPAGES))
239 if (ssop_flags & SSOP_TABPAGES)
241 if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
242 || put_eol(fd) == FAIL)
249 ! ses_winsizes(fd, restore_size)
256 if (restore_size && (ssop_flags & SSOP_WINSIZE))
258 ! for (wp = firstwin; wp != NULL; wp = wp->w_next)
266 ! ses_winsizes(fd, restore_size, tab_firstwin)
269 + win_T *tab_firstwin;
274 if (restore_size && (ssop_flags & SSOP_WINSIZE))
276 ! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
280 *** ../vim-7.0.146/src/version.c Fri Oct 20 20:15:05 2006
281 --- src/version.c Tue Oct 24 12:57:04 2006
285 { /* Add new patch number below this line */
291 hundred-and-one symptoms of being an internet addict:
292 95. Only communication in your household is through email.
294 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
295 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
296 \\\ download, build and distribute -- http://www.A-A-P.org ///
297 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///