]> granicus.if.org Git - vim/commitdiff
patch 8.1.1425: win_execute() does not set window pointers properly v8.1.1425
authorBram Moolenaar <Bram@vim.org>
Thu, 30 May 2019 15:29:40 +0000 (17:29 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 30 May 2019 15:29:40 +0000 (17:29 +0200)
Problem:    Win_execute() does not set window pointers properly.
Solution:   Use switch_win_noblock().  Also execute autocommands in a popup
            window.

src/autocmd.c
src/evalfunc.c
src/proto/window.pro
src/version.c
src/window.c

index 21b9ab3ba5836a94fc5819ce7cd7a7a019d0f480..82b58689dacbbe31b83b94da95695542bc2880c7 100644 (file)
@@ -1349,7 +1349,7 @@ ex_doautoall(exarg_T *eap)
      */
     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
            aucmd_prepbuf(&aco, buf);
@@ -1612,8 +1612,6 @@ apply_autocmds(
     int                force,      // when TRUE, ignore autocmd_busy
     buf_T      *buf)       // buffer for <abuf>
 {
-    if (bt_popup(buf))
-       return FALSE;
     return apply_autocmds_group(event, fname, fname_io, force,
                                                      AUGROUP_ALL, buf, NULL);
 }
index 7753fc65e697918a94d6a03f7b1fbc69bf24a6a9..d1e89eb99b91b7fb60f70996db9a4019e53902d6 100644 (file)
@@ -6116,19 +6116,18 @@ f_win_execute(typval_T *argvars, typval_T *rettv)
 {
     int                id = (int)tv_get_number(argvars);
     win_T      *wp = win_id2wp(id);
-    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, 1);
-       if (win_valid(save_curwin))
+       if (switch_win_noblock(&save_curwin, &save_curtab, wp, curtab, TRUE)
+                                                                        == OK)
        {
-           curwin = save_curwin;
-           curbuf = curwin->w_buffer;
+           check_cursor();
+           execute_common(argvars, rettv, 1);
        }
+       restore_win_noblock(save_curwin, save_curtab, TRUE);
     }
 }
 
index b5cbf6922905da04e39320f86090fd5458a43a6f..1424c3de5aa3752f7505025a4fdac1b8106b41cc 100644 (file)
@@ -77,7 +77,9 @@ void reset_lnums(void);
 void make_snapshot(int idx);
 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_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_noblock(win_T *save_curwin, tabpage_T *save_curtab, int no_display);
 void switch_buffer(bufref_T *save_curbuf, buf_T *buf);
 void restore_buffer(bufref_T *save_curbuf);
 int win_hasvertsplit(void);
index 89068d87a5f8140ae49a07110595dbe88ff5a8e2..fa42ac260faad8882473f9473c3c5acccf4854ed 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1425,
 /**/
     1424,
 /**/
index 0a8ef8f255127d46298b23bf17b86da3f59e10b4..07c8780df20399519032a29eec095c29388c47d7 100644 (file)
@@ -6495,6 +6495,20 @@ switch_win(
     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)
     {
@@ -6524,9 +6538,22 @@ switch_win(
  */
     void
 restore_win(
-    win_T      *save_curwin UNUSED,
-    tabpage_T  *save_curtab UNUSED,
-    int                no_display UNUSED)
+    win_T      *save_curwin,
+    tabpage_T  *save_curtab,
+    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))
     {
@@ -6546,7 +6573,6 @@ restore_win(
        curwin = save_curwin;
        curbuf = curwin->w_buffer;
     }
-    unblock_autocmds();
 }
 
 /*