diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-15 21:19:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-15 21:19:08 +0200 |
commit | ab176ce982ac67f7cfcfa1fa885f9117ef8bbafe (patch) | |
tree | 1e94db2dba298e4b79093b7ed50af934f9ff6ffe /src/popupwin.c | |
parent | ad72350360d1a68d251da62a6e8610950926278c (diff) | |
download | vim-git-ab176ce982ac67f7cfcfa1fa885f9117ef8bbafe.tar.gz |
patch 8.2.0984: not using previous window when closing a shell popup windowv8.2.0984
Problem: Not using previous window when closing a shell popup window.
Solution: Use "prevwin" if it was set. (closes #6267)
Diffstat (limited to 'src/popupwin.c')
-rw-r--r-- | src/popupwin.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/popupwin.c b/src/popupwin.c index fbda48bf7..d144be73f 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -2148,6 +2148,19 @@ invoke_popup_callback(win_T *wp, typval_T *result) } /* + * 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,10 +2191,8 @@ popup_close_and_callback(win_T *wp, typval_T *arg) break; if (owp != NULL) win_enter(owp, FALSE); - else if (win_valid(prevwin) && wp != prevwin) - win_enter(prevwin, FALSE); else - win_enter(firstwin, FALSE); + back_to_prevwin(wp); } } #endif @@ -2583,7 +2594,7 @@ popup_close(int id, int force) error_for_popup_window(); return FAIL; } - win_enter(firstwin, FALSE); + back_to_prevwin(wp); } if (prev == NULL) first_popupwin = wp->w_next; @@ -2620,7 +2631,7 @@ popup_close_tabpage(tabpage_T *tp, int id, int force) error_for_popup_window(); return FAIL; } - win_enter(firstwin, FALSE); + back_to_prevwin(wp); } if (prev == NULL) *root = wp->w_next; |