To: vim_dev@googlegroups.com Subject: Patch 8.1.2315 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2315 Problem: Not always using the right window when jumping to an error. Solution: Add the "uselast" flag in 'switchbuf'. (closes #1652) Files: runtime/doc/options.txt, src/option.h, src/optionstr.c, src/quickfix.c, src/testdir/test_quickfix.vim *** ../vim-8.1.2314/runtime/doc/options.txt 2019-11-10 21:00:21.418665688 +0100 --- runtime/doc/options.txt 2019-11-17 17:50:44.692778637 +0100 *************** *** 7415,7420 **** --- 7417,7424 ---- vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. + uselast If included, jump to the previously used window when + jumping to errors with |quickfix| commands. *'synmaxcol'* *'smc'* 'synmaxcol' 'smc' number (default 3000) *** ../vim-8.1.2314/src/option.h 2019-11-09 23:26:36.901570979 +0100 --- src/option.h 2019-11-17 18:07:30.162709341 +0100 *************** *** 911,921 **** --- 911,923 ---- EXTERN char_u *p_sws; // 'swapsync' EXTERN char_u *p_swb; // 'switchbuf' EXTERN unsigned swb_flags; + // Keep in sync with p_swb_values in optionstr.c #define SWB_USEOPEN 0x001 #define SWB_USETAB 0x002 #define SWB_SPLIT 0x004 #define SWB_NEWTAB 0x008 #define SWB_VSPLIT 0x010 + #define SWB_USELAST 0x020 EXTERN char_u *p_syn; // 'syntax' EXTERN long p_ts; // 'tabstop' EXTERN int p_tbs; // 'tagbsearch' *** ../vim-8.1.2314/src/optionstr.c 2019-11-09 23:26:36.905570965 +0100 --- src/optionstr.c 2019-11-17 18:07:32.726682644 +0100 *************** *** 39,45 **** "localoptions", "options", "help", "blank", "globals", "slash", "unix", "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", NULL}; #endif ! static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", NULL}; static char *(p_tc_values[]) = {"followic", "ignore", "match", "followscs", "smart", NULL}; #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL}; --- 39,46 ---- "localoptions", "options", "help", "blank", "globals", "slash", "unix", "sesdir", "curdir", "folds", "cursor", "tabpages", "terminal", NULL}; #endif ! // Keep in sync with SWB_ flags in option.h ! static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", "vsplit", "uselast", NULL}; static char *(p_tc_values[]) = {"followic", "ignore", "match", "followscs", "smart", NULL}; #if defined(FEAT_TOOLBAR) && !defined(FEAT_GUI_MSWIN) static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL}; *** ../vim-8.1.2314/src/quickfix.c 2019-11-12 22:59:46.556547871 +0100 --- src/quickfix.c 2019-11-17 17:59:09.417679990 +0100 *************** *** 3013,3020 **** if (IS_QF_WINDOW(win)) { // Didn't find it, go to the window before the quickfix ! // window. ! if (altwin != NULL) win = altwin; else if (curwin->w_prev != NULL) win = curwin->w_prev; --- 3013,3023 ---- if (IS_QF_WINDOW(win)) { // Didn't find it, go to the window before the quickfix ! // window, unless 'switchbuf' contains 'uselast': in this case we ! // try to jump to the previously used window first. ! if ((swb_flags & SWB_USELAST) && win_valid(prevwin)) ! win = prevwin; ! else if (altwin != NULL) win = altwin; else if (curwin->w_prev != NULL) win = curwin->w_prev; *** ../vim-8.1.2314/src/testdir/test_quickfix.vim 2019-11-16 21:04:54.324424732 +0100 --- src/testdir/test_quickfix.vim 2019-11-17 17:50:44.696778631 +0100 *************** *** 1664,1669 **** --- 1664,1677 ---- call assert_equal(3, tabpagenr('$')) tabfirst | enew | tabonly | only + set switchbuf=uselast + split + let last_winid = win_getid() + copen + exe "normal 1G\" + call assert_equal(last_winid, win_getid()) + enew | only + set switchbuf= edit Xqftestfile1 let file1_winid = win_getid() *** ../vim-8.1.2314/src/version.c 2019-11-17 17:32:24.373473658 +0100 --- src/version.c 2019-11-17 17:50:32.256803044 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2315, /**/ -- From "know your smileys": %-) After staring at screen for 15 hours /// 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 ///