1
0
forked from aniani/vim

updated for version 7.0-147

This commit is contained in:
Bram Moolenaar
2006-10-24 10:59:57 +00:00
parent 38c0a6e6fa
commit cba2ae53a6
2 changed files with 35 additions and 16 deletions

View File

@@ -9643,7 +9643,8 @@ expand_sfile(arg)
#endif #endif
#ifdef FEAT_SESSION #ifdef FEAT_SESSION
static int ses_winsizes __ARGS((FILE *fd, int restore_size)); static int ses_winsizes __ARGS((FILE *fd, int restore_size,
win_T *tab_firstwin));
static int ses_win_rec __ARGS((FILE *fd, frame_T *fr)); static int ses_win_rec __ARGS((FILE *fd, frame_T *fr));
static frame_T *ses_skipframe __ARGS((frame_T *fr)); static frame_T *ses_skipframe __ARGS((frame_T *fr));
static int ses_do_frame __ARGS((frame_T *fr)); static int ses_do_frame __ARGS((frame_T *fr));
@@ -9669,8 +9670,8 @@ makeopens(fd, dirnow)
win_T *wp; win_T *wp;
char_u *sname; char_u *sname;
win_T *edited_win = NULL; win_T *edited_win = NULL;
tabpage_T *old_curtab = curtab;
int tabnr; int tabnr;
win_T *tab_firstwin;
if (ssop_flags & SSOP_BUFFERS) if (ssop_flags & SSOP_BUFFERS)
only_save_windows = FALSE; /* Save ALL buffers */ only_save_windows = FALSE; /* Save ALL buffers */
@@ -9778,14 +9779,26 @@ makeopens(fd, dirnow)
/* /*
* May repeat putting Windows for each tab, when "tabpages" is in * May repeat putting Windows for each tab, when "tabpages" is in
* 'sessionoptions'. * 'sessionoptions'.
* Don't use goto_tabpage(), it may change directory and trigger
* autocommands.
*/ */
tab_firstwin = firstwin; /* first window in tab page "tabnr" */
for (tabnr = 1; ; ++tabnr) for (tabnr = 1; ; ++tabnr)
{ {
int need_tabnew = FALSE;
if ((ssop_flags & SSOP_TABPAGES)) if ((ssop_flags & SSOP_TABPAGES))
{ {
goto_tabpage(tabnr); tabpage_T *tp = find_tabpage(tabnr);
if (tabnr > 1 && put_line(fd, "tabnew") == FAIL)
return FAIL; if (tp == NULL)
break; /* done all tab pages */
if (tp == curtab)
tab_firstwin = firstwin;
else
tab_firstwin = tp->tp_firstwin;
if (tabnr > 1)
need_tabnew = TRUE;
} }
/* /*
@@ -9793,7 +9806,7 @@ makeopens(fd, dirnow)
* is aborted we don't end up with a number of useless windows. * is aborted we don't end up with a number of useless windows.
* This may have side effects! (e.g., compressed or network file). * This may have side effects! (e.g., compressed or network file).
*/ */
for (wp = firstwin; wp != NULL; wp = wp->w_next) for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
{ {
if (ses_do_win(wp) if (ses_do_win(wp)
&& wp->w_buffer->b_ffname != NULL && wp->w_buffer->b_ffname != NULL
@@ -9803,15 +9816,20 @@ makeopens(fd, dirnow)
#endif #endif
) )
{ {
if (fputs("edit ", fd) < 0 if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL) || ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
return FAIL; return FAIL;
need_tabnew = FALSE;
if (!wp->w_arg_idx_invalid) if (!wp->w_arg_idx_invalid)
edited_win = wp; edited_win = wp;
break; break;
} }
} }
/* If no file got edited create an empty tab page. */
if (need_tabnew && put_line(fd, "tabnew") == FAIL)
return FAIL;
/* /*
* Save current window layout. * Save current window layout.
*/ */
@@ -9829,7 +9847,7 @@ makeopens(fd, dirnow)
* Remember the window number of the current window after restoring. * Remember the window number of the current window after restoring.
*/ */
nr = 0; nr = 0;
for (wp = firstwin; wp != NULL; wp = W_NEXT(wp)) for (wp = tab_firstwin; wp != NULL; wp = W_NEXT(wp))
{ {
if (ses_do_win(wp)) if (ses_do_win(wp))
++nr; ++nr;
@@ -9852,13 +9870,13 @@ makeopens(fd, dirnow)
*/ */
if (put_line(fd, "set winheight=1 winwidth=1") == FAIL) if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
return FAIL; return FAIL;
if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL) if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
return FAIL; return FAIL;
/* /*
* Restore the view of the window (options, file, cursor, etc.). * Restore the view of the window (options, file, cursor, etc.).
*/ */
for (wp = firstwin; wp != NULL; wp = wp->w_next) for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
{ {
if (!ses_do_win(wp)) if (!ses_do_win(wp))
continue; continue;
@@ -9879,19 +9897,17 @@ makeopens(fd, dirnow)
* Restore window sizes again after jumping around in windows, because * Restore window sizes again after jumping around in windows, because
* the current window has a minimum size while others may not. * the current window has a minimum size while others may not.
*/ */
if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL) if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
return FAIL; return FAIL;
/* Don't continue in another tab page when doing only the current one /* Don't continue in another tab page when doing only the current one
* or when at the last tab page. */ * or when at the last tab page. */
if (!(ssop_flags & SSOP_TABPAGES) || curtab->tp_next == NULL) if (!(ssop_flags & SSOP_TABPAGES))
break; break;
} }
if (ssop_flags & SSOP_TABPAGES) if (ssop_flags & SSOP_TABPAGES)
{ {
if (valid_tabpage(old_curtab))
goto_tabpage_tp(old_curtab);
if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0 if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
|| put_eol(fd) == FAIL) || put_eol(fd) == FAIL)
return FAIL; return FAIL;
@@ -9927,16 +9943,17 @@ makeopens(fd, dirnow)
} }
static int static int
ses_winsizes(fd, restore_size) ses_winsizes(fd, restore_size, tab_firstwin)
FILE *fd; FILE *fd;
int restore_size; int restore_size;
win_T *tab_firstwin;
{ {
int n = 0; int n = 0;
win_T *wp; win_T *wp;
if (restore_size && (ssop_flags & SSOP_WINSIZE)) if (restore_size && (ssop_flags & SSOP_WINSIZE))
{ {
for (wp = firstwin; wp != NULL; wp = wp->w_next) for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
{ {
if (!ses_do_win(wp)) if (!ses_do_win(wp))
continue; continue;

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
147,
/**/ /**/
146, 146,
/**/ /**/