|
Karsten Hopp |
bc9fed |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
bc9fed |
Subject: Patch 7.3.963
|
|
Karsten Hopp |
bc9fed |
Fcc: outbox
|
|
Karsten Hopp |
bc9fed |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
bc9fed |
Mime-Version: 1.0
|
|
Karsten Hopp |
bc9fed |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
bc9fed |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
bc9fed |
------------
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
Patch 7.3.963
|
|
Karsten Hopp |
bc9fed |
Problem: Setting curbuf without curwin causes trouble.
|
|
Karsten Hopp |
bc9fed |
Solution: Add switch_buffer() and restore_buffer(). Block autocommands to
|
|
Karsten Hopp |
bc9fed |
avoid trouble.
|
|
Karsten Hopp |
bc9fed |
Files: src/eval.c, src/proto/eval.pro, src/proto/window.pro,
|
|
Karsten Hopp |
bc9fed |
src/if_py_both.h, src/window.c, src/testdir/test86.ok
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/eval.c 2013-05-15 14:39:47.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/eval.c 2013-05-17 14:50:35.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 11894,11900 ****
|
|
Karsten Hopp |
bc9fed |
win_T *win, *oldcurwin;
|
|
Karsten Hopp |
bc9fed |
char_u *varname;
|
|
Karsten Hopp |
bc9fed |
dictitem_T *v;
|
|
Karsten Hopp |
bc9fed |
! tabpage_T *tp;
|
|
Karsten Hopp |
bc9fed |
int done = FALSE;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
#ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
--- 11894,11900 ----
|
|
Karsten Hopp |
bc9fed |
win_T *win, *oldcurwin;
|
|
Karsten Hopp |
bc9fed |
char_u *varname;
|
|
Karsten Hopp |
bc9fed |
dictitem_T *v;
|
|
Karsten Hopp |
bc9fed |
! tabpage_T *tp, *oldtabpage;
|
|
Karsten Hopp |
bc9fed |
int done = FALSE;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
#ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 11912,11922 ****
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (win != NULL && varname != NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! /* Set curwin to be our win, temporarily. Also set curbuf, so
|
|
Karsten Hopp |
bc9fed |
! * that we can get buffer-local options. */
|
|
Karsten Hopp |
bc9fed |
! oldcurwin = curwin;
|
|
Karsten Hopp |
bc9fed |
! curwin = win;
|
|
Karsten Hopp |
bc9fed |
! curbuf = win->w_buffer;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (*varname == '&') /* window-local-option */
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
--- 11912,11920 ----
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (win != NULL && varname != NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! /* Set curwin to be our win, temporarily. Also set the tabpage,
|
|
Karsten Hopp |
bc9fed |
! * otherwise the window is not valid. */
|
|
Karsten Hopp |
bc9fed |
! switch_win(&oldcurwin, &oldtabpage, win, tp);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (*varname == '&') /* window-local-option */
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 11936,11943 ****
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* restore previous notion of curwin */
|
|
Karsten Hopp |
bc9fed |
! curwin = oldcurwin;
|
|
Karsten Hopp |
bc9fed |
! curbuf = curwin->w_buffer;
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
bc9fed |
--- 11934,11940 ----
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* restore previous notion of curwin */
|
|
Karsten Hopp |
bc9fed |
! restore_win(oldcurwin, oldtabpage);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (!done && argvars[off + 2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 16641,16684 ****
|
|
Karsten Hopp |
bc9fed |
setwinvar(argvars, rettv, 0);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
- int
|
|
Karsten Hopp |
bc9fed |
- switch_win(save_curwin, save_curtab, win, tp)
|
|
Karsten Hopp |
bc9fed |
- win_T **save_curwin;
|
|
Karsten Hopp |
bc9fed |
- tabpage_T **save_curtab;
|
|
Karsten Hopp |
bc9fed |
- win_T *win;
|
|
Karsten Hopp |
bc9fed |
- tabpage_T *tp;
|
|
Karsten Hopp |
bc9fed |
- {
|
|
Karsten Hopp |
bc9fed |
- #ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
- /* set curwin to be our win, temporarily */
|
|
Karsten Hopp |
bc9fed |
- *save_curwin = curwin;
|
|
Karsten Hopp |
bc9fed |
- *save_curtab = curtab;
|
|
Karsten Hopp |
bc9fed |
- goto_tabpage_tp(tp, FALSE, FALSE);
|
|
Karsten Hopp |
bc9fed |
- if (!win_valid(win))
|
|
Karsten Hopp |
bc9fed |
- return FAIL;
|
|
Karsten Hopp |
bc9fed |
- curwin = win;
|
|
Karsten Hopp |
bc9fed |
- curbuf = curwin->w_buffer;
|
|
Karsten Hopp |
bc9fed |
- #endif
|
|
Karsten Hopp |
bc9fed |
- return OK;
|
|
Karsten Hopp |
bc9fed |
- }
|
|
Karsten Hopp |
bc9fed |
-
|
|
Karsten Hopp |
bc9fed |
- void
|
|
Karsten Hopp |
bc9fed |
- restore_win(save_curwin, save_curtab)
|
|
Karsten Hopp |
bc9fed |
- win_T *save_curwin;
|
|
Karsten Hopp |
bc9fed |
- tabpage_T *save_curtab;
|
|
Karsten Hopp |
bc9fed |
- {
|
|
Karsten Hopp |
bc9fed |
- #ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
- /* Restore current tabpage and window, if still valid (autocommands can
|
|
Karsten Hopp |
bc9fed |
- * make them invalid). */
|
|
Karsten Hopp |
bc9fed |
- if (valid_tabpage(save_curtab))
|
|
Karsten Hopp |
bc9fed |
- goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
|
Karsten Hopp |
bc9fed |
- if (win_valid(save_curwin))
|
|
Karsten Hopp |
bc9fed |
- {
|
|
Karsten Hopp |
bc9fed |
- curwin = save_curwin;
|
|
Karsten Hopp |
bc9fed |
- curbuf = curwin->w_buffer;
|
|
Karsten Hopp |
bc9fed |
- }
|
|
Karsten Hopp |
bc9fed |
- #endif
|
|
Karsten Hopp |
bc9fed |
- }
|
|
Karsten Hopp |
bc9fed |
-
|
|
Karsten Hopp |
bc9fed |
/*
|
|
Karsten Hopp |
bc9fed |
* "setwinvar()" and "settabwinvar()" functions
|
|
Karsten Hopp |
bc9fed |
*/
|
|
Karsten Hopp |
bc9fed |
--- 16638,16643 ----
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/proto/eval.pro 2013-05-15 14:39:47.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/proto/eval.pro 2013-05-17 16:01:40.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 33,38 ****
|
|
Karsten Hopp |
bc9fed |
--- 33,40 ----
|
|
Karsten Hopp |
bc9fed |
void prof_child_exit __ARGS((proftime_T *tm));
|
|
Karsten Hopp |
bc9fed |
int eval_foldexpr __ARGS((char_u *arg, int *cp));
|
|
Karsten Hopp |
bc9fed |
void ex_let __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
bc9fed |
+ void list_add_watch __ARGS((list_T *l, listwatch_T *lw));
|
|
Karsten Hopp |
bc9fed |
+ void list_rem_watch __ARGS((list_T *l, listwatch_T *lwrem));
|
|
Karsten Hopp |
bc9fed |
void *eval_for_line __ARGS((char_u *arg, int *errp, char_u **nextcmdp, int skip));
|
|
Karsten Hopp |
bc9fed |
int next_for_item __ARGS((void *fi_void, char_u *arg));
|
|
Karsten Hopp |
bc9fed |
void free_for_info __ARGS((void *fi_void));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 125,132 ****
|
|
Karsten Hopp |
bc9fed |
void ex_oldfiles __ARGS((exarg_T *eap));
|
|
Karsten Hopp |
bc9fed |
int modify_fname __ARGS((char_u *src, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen));
|
|
Karsten Hopp |
bc9fed |
char_u *do_string_sub __ARGS((char_u *str, char_u *pat, char_u *sub, char_u *flags));
|
|
Karsten Hopp |
bc9fed |
- int switch_win __ARGS((win_T **, tabpage_T **, win_T *, tabpage_T *));
|
|
Karsten Hopp |
bc9fed |
- void restore_win __ARGS((win_T *, tabpage_T *));
|
|
Karsten Hopp |
bc9fed |
- void list_add_watch __ARGS((list_T *l, listwatch_T *lw));
|
|
Karsten Hopp |
bc9fed |
- void list_rem_watch __ARGS((list_T *l, listwatch_T *lwrem));
|
|
Karsten Hopp |
bc9fed |
/* vim: set ft=c : */
|
|
Karsten Hopp |
bc9fed |
--- 127,130 ----
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/proto/window.pro 2013-05-15 15:12:25.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/proto/window.pro 2013-05-17 15:04:14.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 32,37 ****
|
|
Karsten Hopp |
bc9fed |
--- 32,38 ----
|
|
Karsten Hopp |
bc9fed |
void tabpage_move __ARGS((int nr));
|
|
Karsten Hopp |
bc9fed |
void win_goto __ARGS((win_T *wp));
|
|
Karsten Hopp |
bc9fed |
win_T *win_find_nr __ARGS((int winnr));
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T *win_find_tabpage __ARGS((win_T *win));
|
|
Karsten Hopp |
bc9fed |
void win_enter __ARGS((win_T *wp, int undo_sync));
|
|
Karsten Hopp |
bc9fed |
win_T *buf_jump_open_win __ARGS((buf_T *buf));
|
|
Karsten Hopp |
bc9fed |
win_T *buf_jump_open_tab __ARGS((buf_T *buf));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 69,74 ****
|
|
Karsten Hopp |
bc9fed |
--- 70,79 ----
|
|
Karsten Hopp |
bc9fed |
void check_lnums __ARGS((int do_curwin));
|
|
Karsten Hopp |
bc9fed |
void make_snapshot __ARGS((int idx));
|
|
Karsten Hopp |
bc9fed |
void restore_snapshot __ARGS((int idx, int close_curwin));
|
|
Karsten Hopp |
bc9fed |
+ int switch_win __ARGS((win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp));
|
|
Karsten Hopp |
bc9fed |
+ void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab));
|
|
Karsten Hopp |
bc9fed |
+ void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf));
|
|
Karsten Hopp |
bc9fed |
+ void restore_buffer __ARGS((buf_T *save_curbuf));
|
|
Karsten Hopp |
bc9fed |
int win_hasvertsplit __ARGS((void));
|
|
Karsten Hopp |
bc9fed |
int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id));
|
|
Karsten Hopp |
bc9fed |
int match_delete __ARGS((win_T *wp, int id, int perr));
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/if_py_both.h 2013-05-15 19:07:03.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/if_py_both.h 2013-05-17 15:57:08.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 1413,1426 ****
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
win_T *save_curwin;
|
|
Karsten Hopp |
bc9fed |
tabpage_T *save_curtab;
|
|
Karsten Hopp |
bc9fed |
! aco_save_T aco;
|
|
Karsten Hopp |
bc9fed |
int r = 0;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
switch (opt_type)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
case SREQ_WIN:
|
|
Karsten Hopp |
bc9fed |
! if (switch_win(&save_curwin, &save_curtab, (win_T *) from, curtab)
|
|
Karsten Hopp |
bc9fed |
! == FAIL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim("Problem while switching windows.");
|
|
Karsten Hopp |
bc9fed |
return -1;
|
|
Karsten Hopp |
bc9fed |
--- 1413,1426 ----
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
win_T *save_curwin;
|
|
Karsten Hopp |
bc9fed |
tabpage_T *save_curtab;
|
|
Karsten Hopp |
bc9fed |
! buf_T *save_curbuf;
|
|
Karsten Hopp |
bc9fed |
int r = 0;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
switch (opt_type)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
case SREQ_WIN:
|
|
Karsten Hopp |
bc9fed |
! if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
|
|
Karsten Hopp |
bc9fed |
! win_find_tabpage((win_T *)from)) == FAIL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim("Problem while switching windows.");
|
|
Karsten Hopp |
bc9fed |
return -1;
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 1429,1437 ****
|
|
Karsten Hopp |
bc9fed |
restore_win(save_curwin, save_curtab);
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
case SREQ_BUF:
|
|
Karsten Hopp |
bc9fed |
! aucmd_prepbuf(&aco, (buf_T *) from);
|
|
Karsten Hopp |
bc9fed |
set_option_value(key, numval, stringval, opt_flags);
|
|
Karsten Hopp |
bc9fed |
! aucmd_restbuf(&aco;;
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
case SREQ_GLOBAL:
|
|
Karsten Hopp |
bc9fed |
set_option_value(key, numval, stringval, opt_flags);
|
|
Karsten Hopp |
bc9fed |
--- 1429,1437 ----
|
|
Karsten Hopp |
bc9fed |
restore_win(save_curwin, save_curtab);
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
case SREQ_BUF:
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&save_curbuf, (buf_T *)from);
|
|
Karsten Hopp |
bc9fed |
set_option_value(key, numval, stringval, opt_flags);
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(save_curbuf);
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
case SREQ_GLOBAL:
|
|
Karsten Hopp |
bc9fed |
set_option_value(key, numval, stringval, opt_flags);
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2240,2249 ****
|
|
Karsten Hopp |
bc9fed |
*/
|
|
Karsten Hopp |
bc9fed |
if (line == Py_None || line == NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savedel((linenr_T)n, 1L) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
--- 2240,2249 ----
|
|
Karsten Hopp |
bc9fed |
*/
|
|
Karsten Hopp |
bc9fed |
if (line == Py_None || line == NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savedel((linenr_T)n, 1L) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2251,2262 ****
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot delete line"));
|
|
Karsten Hopp |
bc9fed |
else
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
|
Karsten Hopp |
bc9fed |
deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
--- 2251,2262 ----
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot delete line"));
|
|
Karsten Hopp |
bc9fed |
else
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
! if (buf == savebuf)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)n, (linenr_T)n + 1, (linenr_T)-1);
|
|
Karsten Hopp |
bc9fed |
deleted_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2269,2282 ****
|
|
Karsten Hopp |
bc9fed |
else if (PyString_Check(line))
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
char *save = StringToLine(line);
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (save == NULL)
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* We do not need to free "save" if ml_replace() consumes it. */
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savesub((linenr_T)n) == FAIL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
--- 2269,2282 ----
|
|
Karsten Hopp |
bc9fed |
else if (PyString_Check(line))
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
char *save = StringToLine(line);
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (save == NULL)
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* We do not need to free "save" if ml_replace() consumes it. */
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savesub((linenr_T)n) == FAIL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2291,2300 ****
|
|
Karsten Hopp |
bc9fed |
else
|
|
Karsten Hopp |
bc9fed |
changed_bytes((linenr_T)n, 0);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* Check that the cursor is not beyond the end of the line now. */
|
|
Karsten Hopp |
bc9fed |
! if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
bc9fed |
check_cursor_col();
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
--- 2291,2300 ----
|
|
Karsten Hopp |
bc9fed |
else
|
|
Karsten Hopp |
bc9fed |
changed_bytes((linenr_T)n, 0);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/* Check that the cursor is not beyond the end of the line now. */
|
|
Karsten Hopp |
bc9fed |
! if (buf == savebuf)
|
|
Karsten Hopp |
bc9fed |
check_cursor_col();
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2333,2342 ****
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
PyInt i;
|
|
Karsten Hopp |
bc9fed |
PyInt n = (int)(hi - lo);
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savedel((linenr_T)lo, (long)n) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
--- 2333,2342 ----
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
PyInt i;
|
|
Karsten Hopp |
bc9fed |
PyInt n = (int)(hi - lo);
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_savedel((linenr_T)lo, (long)n) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2350,2361 ****
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
! if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
|
Karsten Hopp |
bc9fed |
deleted_lines_mark((linenr_T)lo, (long)i);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
--- 2350,2361 ----
|
|
Karsten Hopp |
bc9fed |
break;
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
! if (buf == savebuf)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n);
|
|
Karsten Hopp |
bc9fed |
deleted_lines_mark((linenr_T)lo, (long)i);
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2400,2409 ****
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
- savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
-
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
--- 2400,2409 ----
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
!
|
|
Karsten Hopp |
bc9fed |
! // START of region without "return". Must call restore_buffer()!
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2480,2489 ****
|
|
Karsten Hopp |
bc9fed |
(long)MAXLNUM, (long)extra);
|
|
Karsten Hopp |
bc9fed |
changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! if (buf == curwin->w_buffer)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
--- 2480,2490 ----
|
|
Karsten Hopp |
bc9fed |
(long)MAXLNUM, (long)extra);
|
|
Karsten Hopp |
bc9fed |
changed_lines((linenr_T)lo, 0, (linenr_T)hi, (long)extra);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! if (buf == savebuf)
|
|
Karsten Hopp |
bc9fed |
py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)extra);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! // END of region without "return".
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2522,2531 ****
|
|
Karsten Hopp |
bc9fed |
if (str == NULL)
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
- savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
-
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
--- 2523,2530 ----
|
|
Karsten Hopp |
bc9fed |
if (str == NULL)
|
|
Karsten Hopp |
bc9fed |
return FAIL;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2535,2541 ****
|
|
Karsten Hopp |
bc9fed |
appended_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
vim_free(str);
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
update_screen(VALID);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
--- 2534,2540 ----
|
|
Karsten Hopp |
bc9fed |
appended_lines_mark((linenr_T)n, 1L);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
vim_free(str);
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
update_screen(VALID);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2574,2583 ****
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
- savebuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
-
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
--- 2573,2580 ----
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
PyErr_Clear();
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, buf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
|
|
Karsten Hopp |
bc9fed |
PyErr_SetVim(_("cannot save undo information"));
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 2607,2613 ****
|
|
Karsten Hopp |
bc9fed |
*/
|
|
Karsten Hopp |
bc9fed |
vim_free(array);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf = savebuf;
|
|
Karsten Hopp |
bc9fed |
update_screen(VALID);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
--- 2604,2610 ----
|
|
Karsten Hopp |
bc9fed |
*/
|
|
Karsten Hopp |
bc9fed |
vim_free(array);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
update_screen(VALID);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (PyErr_Occurred() || VimErrorCheck())
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 3023,3029 ****
|
|
Karsten Hopp |
bc9fed |
pos_T *posp;
|
|
Karsten Hopp |
bc9fed |
char *pmark;
|
|
Karsten Hopp |
bc9fed |
char mark;
|
|
Karsten Hopp |
bc9fed |
! buf_T *curbuf_save;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (CheckBuffer((BufferObject *)(self)))
|
|
Karsten Hopp |
bc9fed |
return NULL;
|
|
Karsten Hopp |
bc9fed |
--- 3020,3026 ----
|
|
Karsten Hopp |
bc9fed |
pos_T *posp;
|
|
Karsten Hopp |
bc9fed |
char *pmark;
|
|
Karsten Hopp |
bc9fed |
char mark;
|
|
Karsten Hopp |
bc9fed |
! buf_T *savebuf;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (CheckBuffer((BufferObject *)(self)))
|
|
Karsten Hopp |
bc9fed |
return NULL;
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 3032,3041 ****
|
|
Karsten Hopp |
bc9fed |
return NULL;
|
|
Karsten Hopp |
bc9fed |
mark = *pmark;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! curbuf_save = curbuf;
|
|
Karsten Hopp |
bc9fed |
! curbuf = ((BufferObject *)(self))->buf;
|
|
Karsten Hopp |
bc9fed |
posp = getmark(mark, FALSE);
|
|
Karsten Hopp |
bc9fed |
! curbuf = curbuf_save;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (posp == NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
--- 3029,3037 ----
|
|
Karsten Hopp |
bc9fed |
return NULL;
|
|
Karsten Hopp |
bc9fed |
mark = *pmark;
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
! switch_buffer(&savebuf, ((BufferObject *)(self))->buf);
|
|
Karsten Hopp |
bc9fed |
posp = getmark(mark, FALSE);
|
|
Karsten Hopp |
bc9fed |
! restore_buffer(savebuf);
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
if (posp == NULL)
|
|
Karsten Hopp |
bc9fed |
{
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/window.c 2013-05-15 23:13:06.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/window.c 2013-05-17 15:57:17.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 4058,4063 ****
|
|
Karsten Hopp |
bc9fed |
--- 4058,4082 ----
|
|
Karsten Hopp |
bc9fed |
}
|
|
Karsten Hopp |
bc9fed |
#endif
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
+ #if (defined(FEAT_WINDOWS) && defined(FEAT_PYTHON)) || defined(PROTO)
|
|
Karsten Hopp |
bc9fed |
+ /*
|
|
Karsten Hopp |
bc9fed |
+ * Find the tabpage for window "win".
|
|
Karsten Hopp |
bc9fed |
+ */
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T *
|
|
Karsten Hopp |
bc9fed |
+ win_find_tabpage(win)
|
|
Karsten Hopp |
bc9fed |
+ win_T *win;
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ win_T *wp;
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T *tp;
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
+ for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
|
|
Karsten Hopp |
bc9fed |
+ for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next)
|
|
Karsten Hopp |
bc9fed |
+ if (wp == win)
|
|
Karsten Hopp |
bc9fed |
+ return tp;
|
|
Karsten Hopp |
bc9fed |
+ return NULL;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ #endif
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
#ifdef FEAT_VERTSPLIT
|
|
Karsten Hopp |
bc9fed |
/*
|
|
Karsten Hopp |
bc9fed |
* Move to window above or below "count" times.
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 6550,6555 ****
|
|
Karsten Hopp |
bc9fed |
--- 6569,6673 ----
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
#endif
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
+ #if defined(FEAT_EVAL) || defined(PROTO)
|
|
Karsten Hopp |
bc9fed |
+ /*
|
|
Karsten Hopp |
bc9fed |
+ * Set "win" to be the curwin and "tp" to be the current tab page.
|
|
Karsten Hopp |
bc9fed |
+ * restore_win() MUST be called to undo.
|
|
Karsten Hopp |
bc9fed |
+ * No autocommands will be executed.
|
|
Karsten Hopp |
bc9fed |
+ * Returns FAIL if switching to "win" failed.
|
|
Karsten Hopp |
bc9fed |
+ */
|
|
Karsten Hopp |
bc9fed |
+ int
|
|
Karsten Hopp |
bc9fed |
+ switch_win(save_curwin, save_curtab, win, tp)
|
|
Karsten Hopp |
bc9fed |
+ win_T **save_curwin;
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T **save_curtab;
|
|
Karsten Hopp |
bc9fed |
+ win_T *win;
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T *tp;
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
bc9fed |
+ block_autocmds();
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
+ *save_curwin = curwin;
|
|
Karsten Hopp |
bc9fed |
+ if (tp != NULL)
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ *save_curtab = curtab;
|
|
Karsten Hopp |
bc9fed |
+ goto_tabpage_tp(tp, FALSE, FALSE);
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ if (!win_valid(win))
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
bc9fed |
+ unblock_autocmds();
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ return FAIL;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ curwin = win;
|
|
Karsten Hopp |
bc9fed |
+ curbuf = curwin->w_buffer;
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ return OK;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
+ /*
|
|
Karsten Hopp |
bc9fed |
+ * Restore current tabpage and window saved by switch_win(), if still valid.
|
|
Karsten Hopp |
bc9fed |
+ */
|
|
Karsten Hopp |
bc9fed |
+ void
|
|
Karsten Hopp |
bc9fed |
+ restore_win(save_curwin, save_curtab)
|
|
Karsten Hopp |
bc9fed |
+ win_T *save_curwin;
|
|
Karsten Hopp |
bc9fed |
+ tabpage_T *save_curtab;
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_WINDOWS
|
|
Karsten Hopp |
bc9fed |
+ if (save_curtab != NULL && valid_tabpage(save_curtab))
|
|
Karsten Hopp |
bc9fed |
+ goto_tabpage_tp(save_curtab, FALSE, FALSE);
|
|
Karsten Hopp |
bc9fed |
+ if (win_valid(save_curwin))
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ curwin = save_curwin;
|
|
Karsten Hopp |
bc9fed |
+ curbuf = curwin->w_buffer;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
bc9fed |
+ unblock_autocmds();
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
+ /*
|
|
Karsten Hopp |
bc9fed |
+ * Make "buf" the current buffer. restore_buffer() MUST be called to undo.
|
|
Karsten Hopp |
bc9fed |
+ * No autocommands will be executed. Use aucmd_prepbuf() if there are any.
|
|
Karsten Hopp |
bc9fed |
+ */
|
|
Karsten Hopp |
bc9fed |
+ void
|
|
Karsten Hopp |
bc9fed |
+ switch_buffer(save_curbuf, buf)
|
|
Karsten Hopp |
bc9fed |
+ buf_T *buf;
|
|
Karsten Hopp |
bc9fed |
+ buf_T **save_curbuf;
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
bc9fed |
+ block_autocmds();
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ *save_curbuf = curbuf;
|
|
Karsten Hopp |
bc9fed |
+ --curbuf->b_nwindows;
|
|
Karsten Hopp |
bc9fed |
+ curbuf = buf;
|
|
Karsten Hopp |
bc9fed |
+ curwin->w_buffer = buf;
|
|
Karsten Hopp |
bc9fed |
+ ++curbuf->b_nwindows;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
+ /*
|
|
Karsten Hopp |
bc9fed |
+ * Restore the current buffer after using switch_buffer().
|
|
Karsten Hopp |
bc9fed |
+ */
|
|
Karsten Hopp |
bc9fed |
+ void
|
|
Karsten Hopp |
bc9fed |
+ restore_buffer(save_curbuf)
|
|
Karsten Hopp |
bc9fed |
+ buf_T *save_curbuf;
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ # ifdef FEAT_AUTOCMD
|
|
Karsten Hopp |
bc9fed |
+ unblock_autocmds();
|
|
Karsten Hopp |
bc9fed |
+ # endif
|
|
Karsten Hopp |
bc9fed |
+ /* Check for valid buffer, just in case. */
|
|
Karsten Hopp |
bc9fed |
+ if (buf_valid(save_curbuf))
|
|
Karsten Hopp |
bc9fed |
+ {
|
|
Karsten Hopp |
bc9fed |
+ --curbuf->b_nwindows;
|
|
Karsten Hopp |
bc9fed |
+ curwin->w_buffer = save_curbuf;
|
|
Karsten Hopp |
bc9fed |
+ curbuf = save_curbuf;
|
|
Karsten Hopp |
bc9fed |
+ ++curbuf->b_nwindows;
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ }
|
|
Karsten Hopp |
bc9fed |
+ #endif
|
|
Karsten Hopp |
bc9fed |
+
|
|
Karsten Hopp |
bc9fed |
#if (defined(FEAT_GUI) && defined(FEAT_VERTSPLIT)) || defined(PROTO)
|
|
Karsten Hopp |
bc9fed |
/*
|
|
Karsten Hopp |
bc9fed |
* Return TRUE if there is any vertically split window.
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/testdir/test86.ok 2013-05-17 13:37:57.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/testdir/test86.ok 2013-05-17 14:48:57.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 333,339 ****
|
|
Karsten Hopp |
bc9fed |
Current tab pages:
|
|
Karsten Hopp |
bc9fed |
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
|
|
Karsten Hopp |
bc9fed |
Windows:
|
|
Karsten Hopp |
bc9fed |
! <window object (unknown)>(0): displays buffer <buffer test86.in>; cursor is at (955, 0)
|
|
Karsten Hopp |
bc9fed |
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
|
|
Karsten Hopp |
bc9fed |
Windows:
|
|
Karsten Hopp |
bc9fed |
<window object (unknown)>(0): displays buffer <buffer 0>; cursor is at (1, 0)
|
|
Karsten Hopp |
bc9fed |
--- 333,339 ----
|
|
Karsten Hopp |
bc9fed |
Current tab pages:
|
|
Karsten Hopp |
bc9fed |
<tabpage 0>(1): 1 windows, current is <window object (unknown)>
|
|
Karsten Hopp |
bc9fed |
Windows:
|
|
Karsten Hopp |
bc9fed |
! <window object (unknown)>(0): displays buffer <buffer test86.in>; cursor is at (954, 0)
|
|
Karsten Hopp |
bc9fed |
<tabpage 1>(2): 1 windows, current is <window object (unknown)>
|
|
Karsten Hopp |
bc9fed |
Windows:
|
|
Karsten Hopp |
bc9fed |
<window object (unknown)>(0): displays buffer <buffer 0>; cursor is at (1, 0)
|
|
Karsten Hopp |
bc9fed |
*** ../vim-7.3.962/src/version.c 2013-05-17 13:37:57.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
--- src/version.c 2013-05-17 15:59:48.000000000 +0200
|
|
Karsten Hopp |
bc9fed |
***************
|
|
Karsten Hopp |
bc9fed |
*** 730,731 ****
|
|
Karsten Hopp |
bc9fed |
--- 730,733 ----
|
|
Karsten Hopp |
bc9fed |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
bc9fed |
+ /**/
|
|
Karsten Hopp |
bc9fed |
+ 963,
|
|
Karsten Hopp |
bc9fed |
/**/
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
--
|
|
Karsten Hopp |
bc9fed |
TIM: That is not an ordinary rabbit ... 'tis the most foul cruel and
|
|
Karsten Hopp |
bc9fed |
bad-tempered thing you ever set eyes on.
|
|
Karsten Hopp |
bc9fed |
ROBIN: You tit. I soiled my armour I was so scared!
|
|
Karsten Hopp |
bc9fed |
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
|
|
Karsten Hopp |
bc9fed |
|
|
Karsten Hopp |
bc9fed |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
bc9fed |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
bc9fed |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
bc9fed |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|