[patch] wincmd error during session restore

32 views
Skip to first unread message

Jacob Niehus

unread,
Apr 13, 2015, 12:21:42 AM4/13/15
to vim...@googlegroups.com
When the current window is greater than one and another tab page exists with only one window, loading the session causes an error. The variable tracking the current window number in 'makeopens' is not reset for each tab page.

To reproduce (tested in 7.4.692):

vim -u NONE -i NONE -N ~/.vimrc -c 'wincmd s' -c 'wincmd v' -c 'wincmd T' -c 'normal 1gt' -c '2wincmd w' -c 'mks! ~/test.vis' -c 'qa'; vim -u NONE -i NONE -N -S ~/test.vis

Patch to fix the problem:

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -10845,7 +10845,6 @@
buf_T *buf;
int only_save_windows = TRUE;
int nr;
- int cnr = 1;
int restore_size = TRUE;
win_T *wp;
char_u *sname;
@@ -10984,6 +10983,7 @@
for (tabnr = 1; ; ++tabnr)
{
int need_tabnew = FALSE;
+ int cnr = 1;

if ((ssop_flags & SSOP_TABPAGES))
{
vim-v7.4.692-mksession-fix.patch

Bram Moolenaar

unread,
Apr 13, 2015, 6:40:33 AM4/13/15
to Jacob Niehus, vim...@googlegroups.com

Joachim Niehus wrote:

> When the current window is greater than one and another tab page
> exists with only one window, loading the session causes an error. The
> variable tracking the current window number in 'makeopens' is not
> reset for each tab page.
>
> To reproduce (tested in 7.4.692):
>
> vim -u NONE -i NONE -N ~/.vimrc -c 'wincmd s' -c 'wincmd v' -c 'wincmd
> T' -c 'normal 1gt' -c '2wincmd w' -c 'mks! ~/test.vis' -c 'qa'; vim -u
> NONE -i NONE -N -S ~/test.vis
>
> Patch to fix the problem:

Good catch, and thanks for the fix.

--
FATAL ERROR! SYSTEM HALTED! - Press any key to continue doing nothing.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages