aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 21:56:48 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-12-20 23:17:03 -0500
commitebb0cbc6cccb0b75507815939aa761ae625ba0df (patch)
tree142f01b78c29051cf360ad3ada0efac6bd3e6d3f /src/nvim/window.c
parentd1142e02bf943aa40a80e0bdbf0687d65df4dfa2 (diff)
downloadrneovim-ebb0cbc6cccb0b75507815939aa761ae625ba0df.tar.gz
rneovim-ebb0cbc6cccb0b75507815939aa761ae625ba0df.tar.bz2
rneovim-ebb0cbc6cccb0b75507815939aa761ae625ba0df.zip
vim-patch:8.2.1966: popup becomes current window after closing a terminal window
Problem: Popup becomes current window after closing a terminal window. Solution: When restoring the window after executing autocommands, check that the window ID is still the same. (Naruhiko Nishino, closes vim/vim#7272) https://github.com/vim/vim/commit/cbcd9cbd77acc8cc97c0d44683d96c01d3dd0fa7
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 0f17e2cb09..ad1e1f8f02 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1637,6 +1637,19 @@ bool win_valid(const win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
return false;
}
+// Find window "handle" in the current tab page.
+// Return NULL if not found.
+win_T *win_find_by_handle(handle_T handle)
+ FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
+ if (wp->handle == handle) {
+ return wp;
+ }
+ }
+ return NULL;
+}
+
/// Check if "win" is a pointer to an existing window in any tabpage.
///
/// @param win window to check