From 5d2ca0402954ff79b73d9c86cc16c8a6454b75a7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 26 Jun 2016 17:11:21 +0200 Subject: patch 7.4.1956 Problem: When using CTRL-W f and pressing "q" at the ATTENTION dialog the newly opened window is not closed. Solution: Close the window and go back to the original one. (Norio Takagi, Hirohito Higashi) --- src/window.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/window.c') diff --git a/src/window.c b/src/window.c index 2dc255467..c3cd7a233 100644 --- a/src/window.c +++ b/src/window.c @@ -475,6 +475,8 @@ wingotofile: ptr = grab_file_name(Prenum1, &lnum); if (ptr != NULL) { + tabpage_T *oldtab = curtab; + win_T *oldwin = curwin; # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif @@ -482,9 +484,15 @@ wingotofile: if (win_split(0, 0) == OK) { RESET_BINDING(curwin); - (void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, - ECMD_HIDE, NULL); - if (nchar == 'F' && lnum >= 0) + if (do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, + ECMD_HIDE, NULL) == FAIL) + { + /* Failed to open the file, close the window + * opened for it. */ + win_close(curwin, FALSE); + goto_tabpage_win(oldtab, oldwin); + } + else if (nchar == 'F' && lnum >= 0) { curwin->w_cursor.lnum = lnum; check_cursor_lnum(); -- cgit v1.2.1