|
Karsten Hopp |
b3ded7 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
b3ded7 |
Subject: Patch 7.0.147
|
|
Karsten Hopp |
b3ded7 |
Fcc: outbox
|
|
Karsten Hopp |
b3ded7 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b3ded7 |
Mime-Version: 1.0
|
|
Karsten Hopp |
b3ded7 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
b3ded7 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b3ded7 |
------------
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
Patch 7.0.147
|
|
Karsten Hopp |
b3ded7 |
Problem: When creating a session file and there are several tab pages and
|
|
Karsten Hopp |
b3ded7 |
some windows have a local directory a short file name may be used
|
|
Karsten Hopp |
b3ded7 |
when it's not valid. (Marius Roets)
|
|
Karsten Hopp |
b3ded7 |
A session with multiple tab pages may result in "No Name" buffers.
|
|
Karsten Hopp |
b3ded7 |
(Bill McCarthy)
|
|
Karsten Hopp |
b3ded7 |
Solution: Don't enter tab pages when going through the list, only use a
|
|
Karsten Hopp |
b3ded7 |
pointer to the first window in each tab page.
|
|
Karsten Hopp |
b3ded7 |
Use "tabedit" instead of "tabnew | edit" when possible.
|
|
Karsten Hopp |
b3ded7 |
Files: src/ex_docmd.c
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
*** ../vim-7.0.146/src/ex_docmd.c Sun Sep 10 21:05:39 2006
|
|
Karsten Hopp |
b3ded7 |
--- src/ex_docmd.c Tue Oct 24 12:55:11 2006
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9643,9649 ****
|
|
Karsten Hopp |
b3ded7 |
#endif
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
#ifdef FEAT_SESSION
|
|
Karsten Hopp |
b3ded7 |
! static int ses_winsizes __ARGS((FILE *fd, int restore_size));
|
|
Karsten Hopp |
b3ded7 |
static int ses_win_rec __ARGS((FILE *fd, frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
static frame_T *ses_skipframe __ARGS((frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
static int ses_do_frame __ARGS((frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
--- 9643,9650 ----
|
|
Karsten Hopp |
b3ded7 |
#endif
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
#ifdef FEAT_SESSION
|
|
Karsten Hopp |
b3ded7 |
! static int ses_winsizes __ARGS((FILE *fd, int restore_size,
|
|
Karsten Hopp |
b3ded7 |
! win_T *tab_firstwin));
|
|
Karsten Hopp |
b3ded7 |
static int ses_win_rec __ARGS((FILE *fd, frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
static frame_T *ses_skipframe __ARGS((frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
static int ses_do_frame __ARGS((frame_T *fr));
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9669,9676 ****
|
|
Karsten Hopp |
b3ded7 |
win_T *wp;
|
|
Karsten Hopp |
b3ded7 |
char_u *sname;
|
|
Karsten Hopp |
b3ded7 |
win_T *edited_win = NULL;
|
|
Karsten Hopp |
b3ded7 |
- tabpage_T *old_curtab = curtab;
|
|
Karsten Hopp |
b3ded7 |
int tabnr;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (ssop_flags & SSOP_BUFFERS)
|
|
Karsten Hopp |
b3ded7 |
only_save_windows = FALSE; /* Save ALL buffers */
|
|
Karsten Hopp |
b3ded7 |
--- 9670,9677 ----
|
|
Karsten Hopp |
b3ded7 |
win_T *wp;
|
|
Karsten Hopp |
b3ded7 |
char_u *sname;
|
|
Karsten Hopp |
b3ded7 |
win_T *edited_win = NULL;
|
|
Karsten Hopp |
b3ded7 |
int tabnr;
|
|
Karsten Hopp |
b3ded7 |
+ win_T *tab_firstwin;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (ssop_flags & SSOP_BUFFERS)
|
|
Karsten Hopp |
b3ded7 |
only_save_windows = FALSE; /* Save ALL buffers */
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9778,9791 ****
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* May repeat putting Windows for each tab, when "tabpages" is in
|
|
Karsten Hopp |
b3ded7 |
* 'sessionoptions'.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
for (tabnr = 1; ; ++tabnr)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if ((ssop_flags & SSOP_TABPAGES))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! goto_tabpage(tabnr);
|
|
Karsten Hopp |
b3ded7 |
! if (tabnr > 1 && put_line(fd, "tabnew") == FAIL)
|
|
Karsten Hopp |
b3ded7 |
! return FAIL;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
--- 9779,9804 ----
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* May repeat putting Windows for each tab, when "tabpages" is in
|
|
Karsten Hopp |
b3ded7 |
* 'sessionoptions'.
|
|
Karsten Hopp |
b3ded7 |
+ * Don't use goto_tabpage(), it may change directory and trigger
|
|
Karsten Hopp |
b3ded7 |
+ * autocommands.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
+ tab_firstwin = firstwin; /* first window in tab page "tabnr" */
|
|
Karsten Hopp |
b3ded7 |
for (tabnr = 1; ; ++tabnr)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
+ int need_tabnew = FALSE;
|
|
Karsten Hopp |
b3ded7 |
+
|
|
Karsten Hopp |
b3ded7 |
if ((ssop_flags & SSOP_TABPAGES))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! tabpage_T *tp = find_tabpage(tabnr);
|
|
Karsten Hopp |
b3ded7 |
!
|
|
Karsten Hopp |
b3ded7 |
! if (tp == NULL)
|
|
Karsten Hopp |
b3ded7 |
! break; /* done all tab pages */
|
|
Karsten Hopp |
b3ded7 |
! if (tp == curtab)
|
|
Karsten Hopp |
b3ded7 |
! tab_firstwin = firstwin;
|
|
Karsten Hopp |
b3ded7 |
! else
|
|
Karsten Hopp |
b3ded7 |
! tab_firstwin = tp->tp_firstwin;
|
|
Karsten Hopp |
b3ded7 |
! if (tabnr > 1)
|
|
Karsten Hopp |
b3ded7 |
! need_tabnew = TRUE;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9793,9799 ****
|
|
Karsten Hopp |
b3ded7 |
* is aborted we don't end up with a number of useless windows.
|
|
Karsten Hopp |
b3ded7 |
* This may have side effects! (e.g., compressed or network file).
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (ses_do_win(wp)
|
|
Karsten Hopp |
b3ded7 |
&& wp->w_buffer->b_ffname != NULL
|
|
Karsten Hopp |
b3ded7 |
--- 9806,9812 ----
|
|
Karsten Hopp |
b3ded7 |
* is aborted we don't end up with a number of useless windows.
|
|
Karsten Hopp |
b3ded7 |
* This may have side effects! (e.g., compressed or network file).
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (ses_do_win(wp)
|
|
Karsten Hopp |
b3ded7 |
&& wp->w_buffer->b_ffname != NULL
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9803,9817 ****
|
|
Karsten Hopp |
b3ded7 |
#endif
|
|
Karsten Hopp |
b3ded7 |
)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! if (fputs("edit ", fd) < 0
|
|
Karsten Hopp |
b3ded7 |
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
if (!wp->w_arg_idx_invalid)
|
|
Karsten Hopp |
b3ded7 |
edited_win = wp;
|
|
Karsten Hopp |
b3ded7 |
break;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* Save current window layout.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
--- 9816,9835 ----
|
|
Karsten Hopp |
b3ded7 |
#endif
|
|
Karsten Hopp |
b3ded7 |
)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! if (fputs(need_tabnew ? "tabedit " : "edit ", fd) < 0
|
|
Karsten Hopp |
b3ded7 |
|| ses_fname(fd, wp->w_buffer, &ssop_flags) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
+ need_tabnew = FALSE;
|
|
Karsten Hopp |
b3ded7 |
if (!wp->w_arg_idx_invalid)
|
|
Karsten Hopp |
b3ded7 |
edited_win = wp;
|
|
Karsten Hopp |
b3ded7 |
break;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
+ /* If no file got edited create an empty tab page. */
|
|
Karsten Hopp |
b3ded7 |
+ if (need_tabnew && put_line(fd, "tabnew") == FAIL)
|
|
Karsten Hopp |
b3ded7 |
+ return FAIL;
|
|
Karsten Hopp |
b3ded7 |
+
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* Save current window layout.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9829,9835 ****
|
|
Karsten Hopp |
b3ded7 |
* Remember the window number of the current window after restoring.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
nr = 0;
|
|
Karsten Hopp |
b3ded7 |
! for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
++nr;
|
|
Karsten Hopp |
b3ded7 |
--- 9847,9853 ----
|
|
Karsten Hopp |
b3ded7 |
* Remember the window number of the current window after restoring.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
nr = 0;
|
|
Karsten Hopp |
b3ded7 |
! for (wp = tab_firstwin; wp != NULL; wp = W_NEXT(wp))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
++nr;
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9852,9864 ****
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
! if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* Restore the view of the window (options, file, cursor, etc.).
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (!ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
continue;
|
|
Karsten Hopp |
b3ded7 |
--- 9870,9882 ----
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
if (put_line(fd, "set winheight=1 winwidth=1") == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
! if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/*
|
|
Karsten Hopp |
b3ded7 |
* Restore the view of the window (options, file, cursor, etc.).
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (!ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
continue;
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9879,9897 ****
|
|
Karsten Hopp |
b3ded7 |
* Restore window sizes again after jumping around in windows, because
|
|
Karsten Hopp |
b3ded7 |
* the current window has a minimum size while others may not.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! if (nr > 1 && ses_winsizes(fd, restore_size) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/* Don't continue in another tab page when doing only the current one
|
|
Karsten Hopp |
b3ded7 |
* or when at the last tab page. */
|
|
Karsten Hopp |
b3ded7 |
! if (!(ssop_flags & SSOP_TABPAGES) || curtab->tp_next == NULL)
|
|
Karsten Hopp |
b3ded7 |
break;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (ssop_flags & SSOP_TABPAGES)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
- if (valid_tabpage(old_curtab))
|
|
Karsten Hopp |
b3ded7 |
- goto_tabpage_tp(old_curtab);
|
|
Karsten Hopp |
b3ded7 |
if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
|
|
Karsten Hopp |
b3ded7 |
|| put_eol(fd) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
--- 9897,9913 ----
|
|
Karsten Hopp |
b3ded7 |
* Restore window sizes again after jumping around in windows, because
|
|
Karsten Hopp |
b3ded7 |
* the current window has a minimum size while others may not.
|
|
Karsten Hopp |
b3ded7 |
*/
|
|
Karsten Hopp |
b3ded7 |
! if (nr > 1 && ses_winsizes(fd, restore_size, tab_firstwin) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/* Don't continue in another tab page when doing only the current one
|
|
Karsten Hopp |
b3ded7 |
* or when at the last tab page. */
|
|
Karsten Hopp |
b3ded7 |
! if (!(ssop_flags & SSOP_TABPAGES))
|
|
Karsten Hopp |
b3ded7 |
break;
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (ssop_flags & SSOP_TABPAGES)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (fprintf(fd, "tabnext %d", tabpage_index(curtab)) < 0
|
|
Karsten Hopp |
b3ded7 |
|| put_eol(fd) == FAIL)
|
|
Karsten Hopp |
b3ded7 |
return FAIL;
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 9927,9942 ****
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
static int
|
|
Karsten Hopp |
b3ded7 |
! ses_winsizes(fd, restore_size)
|
|
Karsten Hopp |
b3ded7 |
FILE *fd;
|
|
Karsten Hopp |
b3ded7 |
int restore_size;
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
int n = 0;
|
|
Karsten Hopp |
b3ded7 |
win_T *wp;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (restore_size && (ssop_flags & SSOP_WINSIZE))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! for (wp = firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (!ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
continue;
|
|
Karsten Hopp |
b3ded7 |
--- 9943,9959 ----
|
|
Karsten Hopp |
b3ded7 |
}
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
static int
|
|
Karsten Hopp |
b3ded7 |
! ses_winsizes(fd, restore_size, tab_firstwin)
|
|
Karsten Hopp |
b3ded7 |
FILE *fd;
|
|
Karsten Hopp |
b3ded7 |
int restore_size;
|
|
Karsten Hopp |
b3ded7 |
+ win_T *tab_firstwin;
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
int n = 0;
|
|
Karsten Hopp |
b3ded7 |
win_T *wp;
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
if (restore_size && (ssop_flags & SSOP_WINSIZE))
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
! for (wp = tab_firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
b3ded7 |
{
|
|
Karsten Hopp |
b3ded7 |
if (!ses_do_win(wp))
|
|
Karsten Hopp |
b3ded7 |
continue;
|
|
Karsten Hopp |
b3ded7 |
*** ../vim-7.0.146/src/version.c Fri Oct 20 20:15:05 2006
|
|
Karsten Hopp |
b3ded7 |
--- src/version.c Tue Oct 24 12:57:04 2006
|
|
Karsten Hopp |
b3ded7 |
***************
|
|
Karsten Hopp |
b3ded7 |
*** 668,669 ****
|
|
Karsten Hopp |
b3ded7 |
--- 668,671 ----
|
|
Karsten Hopp |
b3ded7 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b3ded7 |
+ /**/
|
|
Karsten Hopp |
b3ded7 |
+ 147,
|
|
Karsten Hopp |
b3ded7 |
/**/
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
--
|
|
Karsten Hopp |
b3ded7 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
b3ded7 |
95. Only communication in your household is through email.
|
|
Karsten Hopp |
b3ded7 |
|
|
Karsten Hopp |
b3ded7 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b3ded7 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b3ded7 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
b3ded7 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|