summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-14 19:08:45 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-14 19:08:45 +0200
commite59215c7dcae17b03daf39517560cfaa03314f5a (patch)
tree6c0a732a4d16d50668db89ea7d5a8f2cd8d35884 /src
parente56132bb4167f8b6ea4814cc2c99a71df3d07ff8 (diff)
patch 7.4.2212v7.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 #974)
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c4
-rw-r--r--src/proto/window.pro1
-rw-r--r--src/testdir/test_viminfo.vim30
-rw-r--r--src/version.c2
-rw-r--r--src/window.c24
5 files changed, 58 insertions, 3 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 2a09a6308b..4f68882558 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -475,7 +475,7 @@ close_buffer(
if (win != NULL
#ifdef FEAT_WINDOWS
- && win_valid(win) /* in case autocommands closed the window */
+ && win_valid_any_tab(win) /* in case autocommands closed the window */
#endif
)
{
@@ -581,7 +581,7 @@ aucmd_abort:
if (
#ifdef FEAT_WINDOWS
- win_valid(win) &&
+ win_valid_any_tab(win) &&
#else
win != NULL &&
#endif
diff --git a/src/proto/window.pro b/src/proto/window.pro
index ebd71ed951..d82988e30b 100644
--- a/src/proto/window.pro
+++ b/src/proto/window.pro
@@ -4,6 +4,7 @@ void get_wincmd_addr_type(char_u *arg, exarg_T *eap);
int win_split(int size, int flags);
int win_split_ins(int size, int flags, win_T *new_wp, int dir);
int win_valid(win_T *win);
+int win_valid_any_tab(win_T *win);
int win_count(void);
int make_windows(int count, int vertical);
void win_move_after(win_T *win1, win_T *win2);
diff --git a/src/testdir/test_viminfo.vim b/src/testdir/test_viminfo.vim
index 4c4935b92e..cbe481c594 100644
--- a/src/testdir/test_viminfo.vim
+++ b/src/testdir/test_viminfo.vim
@@ -425,3 +425,33 @@ func Test_viminfo_file_marks()
call delete('Xviminfo')
endfunc
+
+func Test_viminfo_file_mark_tabclose()
+ tabnew Xtestfileintab
+ call setline(1, ['a','b','c','d','e'])
+ 4
+ q!
+ wviminfo Xviminfo
+ sp Xviminfo
+ /^> .*Xtestfileintab
+ let lnum = line('.')
+ while 1
+ if lnum == line('$')
+ call assert_false(1, 'mark not found in Xtestfileintab')
+ break
+ endif
+ let lnum += 1
+ let line = getline(lnum)
+ if line == ''
+ call assert_false(1, 'mark not found in Xtestfileintab')
+ break
+ endif
+ if line =~ "^\t\""
+ call assert_equal('4', substitute(line, ".*\"\t\\(\\d\\).*", '\1', ''))
+ break
+ endif
+ endwhile
+
+ call delete('Xviminfo')
+ silent! bwipe Xtestfileintab
+endfunc
diff --git a/src/version.c b/src/version.c
index 9be301f1d4..c2900c18d2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2212,
+/**/
2211,
/**/
2210,
diff --git a/src/window.c b/src/window.c
index c6409e1e03..b015d1d01f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1358,7 +1358,7 @@ win_init_some(win_T *newp, win_T *oldp)
#if defined(FEAT_WINDOWS) || defined(PROTO)
/*
- * Check if "win" is a pointer to an existing window.
+ * Check if "win" is a pointer to an existing window in the current tab page.
*/
int
win_valid(win_T *win)
@@ -1374,6 +1374,28 @@ win_valid(win_T *win)
}
/*
+ * Check if "win" is a pointer to an existing window in any tab page.
+ */
+ int
+win_valid_any_tab(win_T *win)
+{
+ win_T *wp;
+ tabpage_T *tp;
+
+ if (win == NULL)
+ return FALSE;
+ FOR_ALL_TABPAGES(tp)
+ {
+ FOR_ALL_WINDOWS_IN_TAB(tp, wp)
+ {
+ if (wp == win)
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/*
* Return the number of windows.
*/
int