Patch 8.2.0984
Problem:    Not using previous window when closing a shell popup window.
Solution:   Use "prevwin" if it was set. (closes #6267)
Files:      src/popupwin.c, src/testdir/test_popupwin.vim


*** ../vim-8.2.0983/src/popupwin.c      2020-05-30 20:30:42.896816552 +0200
--- src/popupwin.c      2020-06-15 21:18:24.249750346 +0200
***************
*** 2148,2153 ****
--- 2148,2166 ----
  }
  
  /*
+  * Make "prevwin" the current window, unless it's equal to "wp".
+  * Otherwise make "firstwin" the current window.
+  */
+     static void
+ back_to_prevwin(win_T *wp)
+ {
+     if (win_valid(prevwin) && wp != prevwin)
+       win_enter(prevwin, FALSE);
+     else
+       win_enter(firstwin, FALSE);
+ }
+ 
+ /*
   * Close popup "wp" and invoke any close callback for it.
   */
      static void
***************
*** 2178,2187 ****
                    break;
            if (owp != NULL)
                win_enter(owp, FALSE);
-           else if (win_valid(prevwin) && wp != prevwin)
-               win_enter(prevwin, FALSE);
            else
!               win_enter(firstwin, FALSE);
        }
      }
  #endif
--- 2191,2198 ----
                    break;
            if (owp != NULL)
                win_enter(owp, FALSE);
            else
!               back_to_prevwin(wp);
        }
      }
  #endif
***************
*** 2583,2589 ****
                    error_for_popup_window();
                    return FAIL;
                }
!               win_enter(firstwin, FALSE);
            }
            if (prev == NULL)
                first_popupwin = wp->w_next;
--- 2594,2600 ----
                    error_for_popup_window();
                    return FAIL;
                }
!               back_to_prevwin(wp);
            }
            if (prev == NULL)
                first_popupwin = wp->w_next;
***************
*** 2620,2626 ****
                    error_for_popup_window();
                    return FAIL;
                }
!               win_enter(firstwin, FALSE);
            }
            if (prev == NULL)
                *root = wp->w_next;
--- 2631,2637 ----
                    error_for_popup_window();
                    return FAIL;
                }
!               back_to_prevwin(wp);
            }
            if (prev == NULL)
                *root = wp->w_next;
*** ../vim-8.2.0983/src/testdir/test_popupwin.vim       2020-05-27 
23:15:12.846004351 +0200
--- src/testdir/test_popupwin.vim       2020-06-15 21:17:39.725929635 +0200
***************
*** 2461,2466 ****
--- 2461,2483 ----
    call assert_equal(origwin, win_getid())
  endfunc
  
+ func Test_popupwin_close_prevwin()
+   CheckFeature terminal
+ 
+   call assert_equal(1, winnr('$'))
+   split
+   wincmd b
+   call assert_equal(2, winnr())
+   let buf = term_start(&shell, #{hidden: 1})
+   call popup_create(buf, {})
+   call term_wait(buf, 100)
+   call popup_clear(1)
+   call assert_equal(2, winnr())
+ 
+   quit
+   exe 'bwipe! ' .. buf
+ endfunc
+ 
  func Test_popupwin_with_buffer_and_filter()
    new Xwithfilter
    call setline(1, range(100))
*** ../vim-8.2.0983/src/version.c       2020-06-15 20:24:53.930811611 +0200
--- src/version.c       2020-06-15 21:06:14.560765771 +0200
***************
*** 756,757 ****
--- 756,759 ----
  {   /* Add new patch number below this line */
+ /**/
+     984,
  /**/

-- 
Q:   How many hardware engineers does it take to change a lightbulb?
A:   None.  We'll fix it in software.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202006151919.05FJJigm1165833%40masaka.moolenaar.net.

Raspunde prin e-mail lui