mirror of
https://github.com/vim/vim.git
synced 2025-09-28 04:24:06 -04:00
patch 8.1.1425: win_execute() does not set window pointers properly
Problem: Win_execute() does not set window pointers properly. Solution: Use switch_win_noblock(). Also execute autocommands in a popup window.
This commit is contained in:
@@ -1349,7 +1349,7 @@ ex_doautoall(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
FOR_ALL_BUFFERS(buf)
|
FOR_ALL_BUFFERS(buf)
|
||||||
{
|
{
|
||||||
if (buf->b_ml.ml_mfp != NULL && !bt_popup(buf))
|
if (buf->b_ml.ml_mfp != NULL)
|
||||||
{
|
{
|
||||||
// find a window for this buffer and save some values
|
// find a window for this buffer and save some values
|
||||||
aucmd_prepbuf(&aco, buf);
|
aucmd_prepbuf(&aco, buf);
|
||||||
@@ -1612,8 +1612,6 @@ apply_autocmds(
|
|||||||
int force, // when TRUE, ignore autocmd_busy
|
int force, // when TRUE, ignore autocmd_busy
|
||||||
buf_T *buf) // buffer for <abuf>
|
buf_T *buf) // buffer for <abuf>
|
||||||
{
|
{
|
||||||
if (bt_popup(buf))
|
|
||||||
return FALSE;
|
|
||||||
return apply_autocmds_group(event, fname, fname_io, force,
|
return apply_autocmds_group(event, fname, fname_io, force,
|
||||||
AUGROUP_ALL, buf, NULL);
|
AUGROUP_ALL, buf, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -6116,19 +6116,18 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
int id = (int)tv_get_number(argvars);
|
int id = (int)tv_get_number(argvars);
|
||||||
win_T *wp = win_id2wp(id);
|
win_T *wp = win_id2wp(id);
|
||||||
win_T *save_curwin = curwin;
|
win_T *save_curwin;
|
||||||
|
tabpage_T *save_curtab;
|
||||||
|
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
{
|
{
|
||||||
curwin = wp;
|
if (switch_win_noblock(&save_curwin, &save_curtab, wp, curtab, TRUE)
|
||||||
curbuf = curwin->w_buffer;
|
== OK)
|
||||||
check_cursor();
|
|
||||||
execute_common(argvars, rettv, 1);
|
|
||||||
if (win_valid(save_curwin))
|
|
||||||
{
|
{
|
||||||
curwin = save_curwin;
|
check_cursor();
|
||||||
curbuf = curwin->w_buffer;
|
execute_common(argvars, rettv, 1);
|
||||||
}
|
}
|
||||||
|
restore_win_noblock(save_curwin, save_curtab, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +77,9 @@ void reset_lnums(void);
|
|||||||
void make_snapshot(int idx);
|
void make_snapshot(int idx);
|
||||||
void restore_snapshot(int idx, int close_curwin);
|
void restore_snapshot(int idx, int close_curwin);
|
||||||
int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display);
|
int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display);
|
||||||
|
int switch_win_noblock(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display);
|
||||||
void restore_win(win_T *save_curwin, tabpage_T *save_curtab, int no_display);
|
void restore_win(win_T *save_curwin, tabpage_T *save_curtab, int no_display);
|
||||||
|
void restore_win_noblock(win_T *save_curwin, tabpage_T *save_curtab, int no_display);
|
||||||
void switch_buffer(bufref_T *save_curbuf, buf_T *buf);
|
void switch_buffer(bufref_T *save_curbuf, buf_T *buf);
|
||||||
void restore_buffer(bufref_T *save_curbuf);
|
void restore_buffer(bufref_T *save_curbuf);
|
||||||
int win_hasvertsplit(void);
|
int win_hasvertsplit(void);
|
||||||
|
@@ -767,6 +767,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 */
|
||||||
|
/**/
|
||||||
|
1425,
|
||||||
/**/
|
/**/
|
||||||
1424,
|
1424,
|
||||||
/**/
|
/**/
|
||||||
|
34
src/window.c
34
src/window.c
@@ -6495,6 +6495,20 @@ switch_win(
|
|||||||
int no_display)
|
int no_display)
|
||||||
{
|
{
|
||||||
block_autocmds();
|
block_autocmds();
|
||||||
|
return switch_win_noblock(save_curwin, save_curtab, win, tp, no_display);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* As switch_win() but without blocking autocommands.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
switch_win_noblock(
|
||||||
|
win_T **save_curwin,
|
||||||
|
tabpage_T **save_curtab,
|
||||||
|
win_T *win,
|
||||||
|
tabpage_T *tp,
|
||||||
|
int no_display)
|
||||||
|
{
|
||||||
*save_curwin = curwin;
|
*save_curwin = curwin;
|
||||||
if (tp != NULL)
|
if (tp != NULL)
|
||||||
{
|
{
|
||||||
@@ -6524,9 +6538,22 @@ switch_win(
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
restore_win(
|
restore_win(
|
||||||
win_T *save_curwin UNUSED,
|
win_T *save_curwin,
|
||||||
tabpage_T *save_curtab UNUSED,
|
tabpage_T *save_curtab,
|
||||||
int no_display UNUSED)
|
int no_display)
|
||||||
|
{
|
||||||
|
restore_win_noblock(save_curwin, save_curtab, no_display);
|
||||||
|
unblock_autocmds();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* As restore_win() but without unblocking autocommands.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
restore_win_noblock(
|
||||||
|
win_T *save_curwin,
|
||||||
|
tabpage_T *save_curtab,
|
||||||
|
int no_display)
|
||||||
{
|
{
|
||||||
if (save_curtab != NULL && valid_tabpage(save_curtab))
|
if (save_curtab != NULL && valid_tabpage(save_curtab))
|
||||||
{
|
{
|
||||||
@@ -6546,7 +6573,6 @@ restore_win(
|
|||||||
curwin = save_curwin;
|
curwin = save_curwin;
|
||||||
curbuf = curwin->w_buffer;
|
curbuf = curwin->w_buffer;
|
||||||
}
|
}
|
||||||
unblock_autocmds();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user