To: vim_dev@googlegroups.com Subject: Patch 7.4.1956 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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) Files: src/window.c, src/testdir/test_window_cmd.vim *** ../vim-7.4.1955/src/window.c 2016-06-04 18:49:15.374070040 +0200 --- src/window.c 2016-06-26 17:06:39.447992143 +0200 *************** *** 475,480 **** --- 475,482 ---- 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,490 **** 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) { curwin->w_cursor.lnum = lnum; check_cursor_lnum(); --- 484,498 ---- if (win_split(0, 0) == OK) { RESET_BINDING(curwin); ! 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(); *** ../vim-7.4.1955/src/testdir/test_window_cmd.vim 2016-05-24 11:31:10.523505120 +0200 --- src/testdir/test_window_cmd.vim 2016-06-26 17:03:42.087114877 +0200 *************** *** 34,37 **** --- 34,70 ---- set ls&vim endfunc + function Test_window_cmd_wincmd_gf() + let fname = 'test_gf.txt' + let swp_fname = '.' . fname . '.swp' + call writefile([], fname) + call writefile([], swp_fname) + function s:swap_exists() + let v:swapchoice = s:swap_choice + endfunc + augroup test_window_cmd_wincmd_gf + autocmd! + exec "autocmd SwapExists " . fname . " call s:swap_exists()" + augroup END + + call setline(1, fname) + " (E)dit anyway + let s:swap_choice = 'e' + wincmd gf + call assert_equal(2, tabpagenr()) + call assert_equal(fname, bufname("%")) + quit! + + " (Q)uit + let s:swap_choice = 'q' + wincmd gf + call assert_equal(1, tabpagenr()) + call assert_notequal(fname, bufname("%")) + new | only! + + call delete(fname) + call delete(swp_fname) + augroup! test_window_cmd_wincmd_gf + endfunc + " vim: sw=2 et *** ../vim-7.4.1955/src/version.c 2016-06-26 16:44:19.519620863 +0200 --- src/version.c 2016-06-26 17:08:34.057972892 +0200 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 1956, /**/ -- In a world without fences, who needs Gates and Windows? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///