To: vim_dev@googlegroups.com
Subject: Patch 7.3.1204
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 7.3.1204
Problem: Calling gettabwinvar() in 'tabline' cancels Visual mode. (Hirohito
Higashi)
Solution: Don't always use goto_tabpage_tp().
Files: src/window.c, src/proto/window.pro, src/eval.c, src/if_py_both.h
*** ../vim-7.3.1203/src/window.c 2013-06-08 18:19:40.000000000 +0200
--- src/window.c 2013-06-16 14:08:52.000000000 +0200
***************
*** 3774,3780 ****
/* We would like doing the TabEnter event first, but we don't have a
* valid current window yet, which may break some commands.
* This triggers autocommands, thus may make "tp" invalid. */
! win_enter_ext(tp->tp_curwin, FALSE, TRUE, trigger_enter_autocmds, trigger_leave_autocmds);
prevwin = next_prevwin;
last_status(FALSE); /* status line may appear or disappear */
--- 3774,3781 ----
/* We would like doing the TabEnter event first, but we don't have a
* valid current window yet, which may break some commands.
* This triggers autocommands, thus may make "tp" invalid. */
! win_enter_ext(tp->tp_curwin, FALSE, TRUE,
! trigger_enter_autocmds, trigger_leave_autocmds);
prevwin = next_prevwin;
last_status(FALSE); /* status line may appear or disappear */
***************
*** 6575,6588 ****
* Set "win" to be the curwin and "tp" to be the current tab page.
* restore_win() MUST be called to undo.
* No autocommands will be executed.
* Returns FAIL if switching to "win" failed.
*/
int
! switch_win(save_curwin, save_curtab, win, tp)
win_T **save_curwin;
tabpage_T **save_curtab;
win_T *win;
tabpage_T *tp;
{
# ifdef FEAT_AUTOCMD
block_autocmds();
--- 6576,6592 ----
* Set "win" to be the curwin and "tp" to be the current tab page.
* restore_win() MUST be called to undo.
* No autocommands will be executed.
+ * When "no_display" is TRUE the display won't be affected, no redraw is
+ * triggered, another tabpage access is limited.
* Returns FAIL if switching to "win" failed.
*/
int
! switch_win(save_curwin, save_curtab, win, tp, no_display)
win_T **save_curwin;
tabpage_T **save_curtab;
win_T *win;
tabpage_T *tp;
+ int no_display;
{
# ifdef FEAT_AUTOCMD
block_autocmds();
***************
*** 6592,6598 ****
if (tp != NULL)
{
*save_curtab = curtab;
! goto_tabpage_tp(tp, FALSE, FALSE);
}
if (!win_valid(win))
{
--- 6596,6611 ----
if (tp != NULL)
{
*save_curtab = curtab;
! if (no_display)
! {
! curtab->tp_firstwin = firstwin;
! curtab->tp_lastwin = lastwin;
! curtab = tp;
! firstwin = curtab->tp_firstwin;
! lastwin = curtab->tp_lastwin;
! }
! else
! goto_tabpage_tp(tp, FALSE, FALSE);
}
if (!win_valid(win))
{
***************
*** 6609,6623 ****
/*
* Restore current tabpage and window saved by switch_win(), if still valid.
*/
void
! restore_win(save_curwin, save_curtab)
win_T *save_curwin;
tabpage_T *save_curtab;
{
# ifdef FEAT_WINDOWS
if (save_curtab != NULL && valid_tabpage(save_curtab))
! goto_tabpage_tp(save_curtab, FALSE, FALSE);
if (win_valid(save_curwin))
{
curwin = save_curwin;
--- 6622,6650 ----
/*
* Restore current tabpage and window saved by switch_win(), if still valid.
+ * When "no_display" is TRUE the display won't be affected, no redraw is
+ * triggered.
*/
void
! restore_win(save_curwin, save_curtab, no_display)
win_T *save_curwin;
tabpage_T *save_curtab;
+ int no_display;
{
# ifdef FEAT_WINDOWS
if (save_curtab != NULL && valid_tabpage(save_curtab))
! {
! if (no_display)
! {
! curtab->tp_firstwin = firstwin;
! curtab->tp_lastwin = lastwin;
! curtab = save_curtab;
! firstwin = curtab->tp_firstwin;
! lastwin = curtab->tp_lastwin;
! }
! else
! goto_tabpage_tp(save_curtab, FALSE, FALSE);
! }
if (win_valid(save_curwin))
{
curwin = save_curwin;
*** ../vim-7.3.1203/src/proto/window.pro 2013-05-17 16:03:53.000000000 +0200
--- src/proto/window.pro 2013-06-16 13:48:18.000000000 +0200
***************
*** 70,77 ****
void check_lnums __ARGS((int do_curwin));
void make_snapshot __ARGS((int idx));
void restore_snapshot __ARGS((int idx, int close_curwin));
! int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp));
! void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab));
void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
void restore_buffer __ARGS((buf_T *save_curbuf));
int win_hasvertsplit __ARGS((void));
--- 70,77 ----
void check_lnums __ARGS((int do_curwin));
void make_snapshot __ARGS((int idx));
void restore_snapshot __ARGS((int idx, int close_curwin));
! int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display));
! void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab, int no_display));
void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
void restore_buffer __ARGS((buf_T *save_curbuf));
int win_hasvertsplit __ARGS((void));
*** ../vim-7.3.1203/src/eval.c 2013-06-13 21:24:01.000000000 +0200
--- src/eval.c 2013-06-16 14:03:15.000000000 +0200
***************
*** 11952,11958 ****
{
/* Set curwin to be our win, temporarily. Also set the tabpage,
* otherwise the window is not valid. */
! switch_win(&oldcurwin, &oldtabpage, win, tp);
if (*varname == '&') /* window-local-option */
{
--- 11952,11958 ----
{
/* Set curwin to be our win, temporarily. Also set the tabpage,
* otherwise the window is not valid. */
! switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
if (*varname == '&') /* window-local-option */
{
***************
*** 11972,11978 ****
}
/* restore previous notion of curwin */
! restore_win(oldcurwin, oldtabpage);
}
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
--- 11972,11978 ----
}
/* restore previous notion of curwin */
! restore_win(oldcurwin, oldtabpage, TRUE);
}
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
***************
*** 16775,16781 ****
if (win != NULL && varname != NULL && varp != NULL)
{
#ifdef FEAT_WINDOWS
! if (switch_win(&save_curwin, &save_curtab, win, tp) == FAIL)
return;
#endif
--- 16775,16781 ----
if (win != NULL && varname != NULL && varp != NULL)
{
#ifdef FEAT_WINDOWS
! if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL)
return;
#endif
***************
*** 16804,16810 ****
}
#ifdef FEAT_WINDOWS
! restore_win(save_curwin, save_curtab);
#endif
}
}
--- 16804,16810 ----
}
#ifdef FEAT_WINDOWS
! restore_win(save_curwin, save_curtab, TRUE);
#endif
}
}
*** ../vim-7.3.1203/src/if_py_both.h 2013-06-12 18:13:31.000000000 +0200
--- src/if_py_both.h 2013-06-16 13:54:21.000000000 +0200
***************
*** 2706,2712 ****
{
case SREQ_WIN:
if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
! win_find_tabpage((win_T *)from)) == FAIL)
{
if (VimTryEnd())
return -1;
--- 2702,2708 ----
{
case SREQ_WIN:
if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
! win_find_tabpage((win_T *)from), FALSE) == FAIL)
{
if (VimTryEnd())
return -1;
***************
*** 2714,2720 ****
return -1;
}
r = set_option_value_err(key, numval, stringval, opt_flags);
! restore_win(save_curwin, save_curtab);
if (r == FAIL)
return -1;
break;
--- 2710,2716 ----
return -1;
}
r = set_option_value_err(key, numval, stringval, opt_flags);
! restore_win(save_curwin, save_curtab, FALSE);
if (r == FAIL)
return -1;
break;
*** ../vim-7.3.1203/src/version.c 2013-06-15 23:00:26.000000000 +0200
--- src/version.c 2013-06-16 13:44:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
{ /* Add new patch number below this line */
+ /**/
+ 1204,
/**/
--
hundred-and-one symptoms of being an internet addict:
224. You set up your own Web page. You set up a Web page for each
of your kids... and your pets.
/// Bram Moolenaar -- Bram@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 ///