diff options
author | Grzegorz Milka <grzegorzmilka@gmail.com> | 2016-10-18 21:04:57 +0200 |
---|---|---|
committer | Grzegorz Milka <grzegorzmilka@gmail.com> | 2016-10-22 23:43:14 +0200 |
commit | 9ca90fdb9fda017962129125ea886fbf07345f62 (patch) | |
tree | 8c5003ec5d97666cadb1a20c1cf463c08bf37c78 /src | |
parent | 500c485e36759f23654de3ce792f3d3b68936c01 (diff) | |
download | rneovim-9ca90fdb9fda017962129125ea886fbf07345f62.tar.gz rneovim-9ca90fdb9fda017962129125ea886fbf07345f62.tar.bz2 rneovim-9ca90fdb9fda017962129125ea886fbf07345f62.zip |
vim-patch:7.4.2212
Problem: Mark " is not set when closing a window in another tab. (Guraga)
Solution: Check all tabs for the window to be valid. (based on patch by
Hirohito Higashi, closes vim/vim#974)
https://github.com/vim/vim/commit/e59215c7dcae17b03daf39517560cfaa03314f5a
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 4 | ||||
-rw-r--r-- | src/nvim/version.c | 2 | ||||
-rw-r--r-- | src/nvim/window.c | 17 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 5fb011885e..176967ad2a 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -323,7 +323,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) wipe_buf = true; } - if (win_valid(win)) { + if (win_valid_any_tab(win)) { /* Set b_last_cursor when closing the last window for the buffer. * Remember the last cursor position and window options of the buffer. * This used to be only for the current window, but then options like @@ -402,7 +402,7 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last) buf->b_nwindows = nwindows; buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0)); - if (win_valid(win) && win->w_buffer == buf) { + if (win_valid_any_tab(win) && win->w_buffer == buf) { win->w_buffer = NULL; // make sure we don't use the buffer now } diff --git a/src/nvim/version.c b/src/nvim/version.c index 2dfe5d3248..1a72238394 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -229,7 +229,7 @@ static int included_patches[] = { // 2215, // 2214 NA 2213, - // 2212, + 2212, // 2211 NA // 2210 NA // 2209, diff --git a/src/nvim/window.c b/src/nvim/window.c index 03a2e9a842..c4e48a9732 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -1065,6 +1065,23 @@ bool win_valid(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT return false; } +/// Check if "win" is a pointer to an existing window in any tabpage. +/// +/// @param win window to check +bool win_valid_any_tab(win_T *win) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT +{ + if (win == NULL) { + return false; + } + + FOR_ALL_TAB_WINDOWS(tp, wp) { + if (wp == win) { + return true; + } + } + return false; +} + /* * Return the number of windows. */ |