mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
vim-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.
89adc3a137
This commit is contained in:
parent
f6518e5516
commit
97abf8ee63
@ -2042,17 +2042,16 @@ static void f_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
static void f_win_execute(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
win_T *wp = win_id2wp(argvars);
|
||||
win_T *save_curwin = curwin;
|
||||
win_T *save_curwin;
|
||||
tabpage_T *save_curtab;
|
||||
|
||||
if (wp != NULL) {
|
||||
curwin = wp;
|
||||
curbuf = curwin->w_buffer;
|
||||
check_cursor();
|
||||
execute_common(argvars, rettv, fptr, 1);
|
||||
if (win_valid(save_curwin)) {
|
||||
curwin = save_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
if (switch_win_noblock(&save_curwin, &save_curtab, wp, curtab, true) ==
|
||||
OK) {
|
||||
check_cursor();
|
||||
execute_common(argvars, rettv, fptr, 1);
|
||||
}
|
||||
restore_win_noblock(save_curwin, save_curtab, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6335,6 +6335,13 @@ static win_T *get_snapshot_focus(int idx)
|
||||
int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage_T *tp, int no_display)
|
||||
{
|
||||
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;
|
||||
if (tp != NULL) {
|
||||
*save_curtab = curtab;
|
||||
@ -6359,6 +6366,14 @@ int switch_win(win_T **save_curwin, tabpage_T **save_curtab, win_T *win, tabpage
|
||||
// When "no_display" is true the display won't be affected, no redraw is
|
||||
// triggered.
|
||||
void restore_win(win_T *save_curwin, tabpage_T *save_curtab, bool 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,
|
||||
bool no_display)
|
||||
{
|
||||
if (save_curtab != NULL && valid_tabpage(save_curtab)) {
|
||||
if (no_display) {
|
||||
@ -6374,7 +6389,6 @@ void restore_win(win_T *save_curwin, tabpage_T *save_curtab, bool no_display)
|
||||
curwin = save_curwin;
|
||||
curbuf = curwin->w_buffer;
|
||||
}
|
||||
unblock_autocmds();
|
||||
}
|
||||
|
||||
/// Make "buf" the current buffer.
|
||||
|
Loading…
Reference in New Issue
Block a user