0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.3.1204

Problem:    Calling gettabwinvar() in 'tabline' cancels Visual mode. (Hirohito
            Higashi)
Solution:   Don't always use goto_tabpage_tp().
This commit is contained in:
Bram Moolenaar
2013-06-16 14:18:28 +02:00
parent 4ce239b0b1
commit d69497413f
5 changed files with 42 additions and 13 deletions

View File

@@ -11952,7 +11952,7 @@ getwinvar(argvars, rettv, off)
{ {
/* Set curwin to be our win, temporarily. Also set the tabpage, /* Set curwin to be our win, temporarily. Also set the tabpage,
* otherwise the window is not valid. */ * otherwise the window is not valid. */
switch_win(&oldcurwin, &oldtabpage, win, tp); switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE);
if (*varname == '&') /* window-local-option */ if (*varname == '&') /* window-local-option */
{ {
@@ -11972,7 +11972,7 @@ getwinvar(argvars, rettv, off)
} }
/* restore previous notion of curwin */ /* restore previous notion of curwin */
restore_win(oldcurwin, oldtabpage); restore_win(oldcurwin, oldtabpage, TRUE);
} }
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN) if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
@@ -16775,7 +16775,7 @@ setwinvar(argvars, rettv, off)
if (win != NULL && varname != NULL && varp != NULL) if (win != NULL && varname != NULL && varp != NULL)
{ {
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
if (switch_win(&save_curwin, &save_curtab, win, tp) == FAIL) if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL)
return; return;
#endif #endif
@@ -16804,7 +16804,7 @@ setwinvar(argvars, rettv, off)
} }
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
restore_win(save_curwin, save_curtab); restore_win(save_curwin, save_curtab, TRUE);
#endif #endif
} }
} }

View File

@@ -2706,7 +2706,7 @@ set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
{ {
case SREQ_WIN: case SREQ_WIN:
if (switch_win(&save_curwin, &save_curtab, (win_T *)from, if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
win_find_tabpage((win_T *)from)) == FAIL) win_find_tabpage((win_T *)from), FALSE) == FAIL)
{ {
if (VimTryEnd()) if (VimTryEnd())
return -1; return -1;
@@ -2714,7 +2714,7 @@ set_option_value_for(key, numval, stringval, opt_flags, opt_type, from)
return -1; return -1;
} }
r = set_option_value_err(key, numval, stringval, opt_flags); r = set_option_value_err(key, numval, stringval, opt_flags);
restore_win(save_curwin, save_curtab); restore_win(save_curwin, save_curtab, FALSE);
if (r == FAIL) if (r == FAIL)
return -1; return -1;
break; break;

View File

@@ -70,8 +70,8 @@ int only_one_window __ARGS((void));
void check_lnums __ARGS((int do_curwin)); void check_lnums __ARGS((int do_curwin));
void make_snapshot __ARGS((int idx)); void make_snapshot __ARGS((int idx));
void restore_snapshot __ARGS((int idx, int close_curwin)); 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 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)); 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 switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
void restore_buffer __ARGS((buf_T *save_curbuf)); void restore_buffer __ARGS((buf_T *save_curbuf));
int win_hasvertsplit __ARGS((void)); int win_hasvertsplit __ARGS((void));

View File

@@ -728,6 +728,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 */
/**/
1204,
/**/ /**/
1203, 1203,
/**/ /**/

View File

@@ -3774,7 +3774,8 @@ enter_tabpage(tp, old_curbuf, trigger_enter_autocmds, trigger_leave_autocmds)
/* We would like doing the TabEnter event first, but we don't have a /* We would like doing the TabEnter event first, but we don't have a
* valid current window yet, which may break some commands. * valid current window yet, which may break some commands.
* This triggers autocommands, thus may make "tp" invalid. */ * This triggers autocommands, thus may make "tp" invalid. */
win_enter_ext(tp->tp_curwin, FALSE, TRUE, trigger_enter_autocmds, trigger_leave_autocmds); win_enter_ext(tp->tp_curwin, FALSE, TRUE,
trigger_enter_autocmds, trigger_leave_autocmds);
prevwin = next_prevwin; prevwin = next_prevwin;
last_status(FALSE); /* status line may appear or disappear */ last_status(FALSE); /* status line may appear or disappear */
@@ -6575,14 +6576,17 @@ restore_snapshot_rec(sn, fr)
* Set "win" to be the curwin and "tp" to be the current tab page. * Set "win" to be the curwin and "tp" to be the current tab page.
* restore_win() MUST be called to undo. * restore_win() MUST be called to undo.
* No autocommands will be executed. * 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. * Returns FAIL if switching to "win" failed.
*/ */
int int
switch_win(save_curwin, save_curtab, win, tp) switch_win(save_curwin, save_curtab, win, tp, no_display)
win_T **save_curwin; win_T **save_curwin;
tabpage_T **save_curtab; tabpage_T **save_curtab;
win_T *win; win_T *win;
tabpage_T *tp; tabpage_T *tp;
int no_display;
{ {
# ifdef FEAT_AUTOCMD # ifdef FEAT_AUTOCMD
block_autocmds(); block_autocmds();
@@ -6592,7 +6596,16 @@ switch_win(save_curwin, save_curtab, win, tp)
if (tp != NULL) if (tp != NULL)
{ {
*save_curtab = curtab; *save_curtab = curtab;
goto_tabpage_tp(tp, FALSE, FALSE); 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)) if (!win_valid(win))
{ {
@@ -6609,15 +6622,29 @@ switch_win(save_curwin, save_curtab, win, tp)
/* /*
* Restore current tabpage and window saved by switch_win(), if still valid. * 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 void
restore_win(save_curwin, save_curtab) restore_win(save_curwin, save_curtab, no_display)
win_T *save_curwin; win_T *save_curwin;
tabpage_T *save_curtab; tabpage_T *save_curtab;
int no_display;
{ {
# ifdef FEAT_WINDOWS # ifdef FEAT_WINDOWS
if (save_curtab != NULL && valid_tabpage(save_curtab)) if (save_curtab != NULL && valid_tabpage(save_curtab))
goto_tabpage_tp(save_curtab, FALSE, FALSE); {
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)) if (win_valid(save_curwin))
{ {
curwin = save_curwin; curwin = save_curwin;