To: vim_dev@googlegroups.com Subject: Patch 8.2.1413 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1413 (after 8.2.1401) Problem: Previous tab page not usable from an Ex command. Solution: Add the "#" argument for :tabnext et al. (Yegappan Lakshmanan, closes #6677) Files: runtime/doc/tabpage.txt, src/ex_docmd.c, src/window.c, src/testdir/test_tabpage.vim *** ../vim-8.2.1412/runtime/doc/tabpage.txt 2020-08-09 14:03:51.541367942 +0200 --- runtime/doc/tabpage.txt 2020-08-10 19:20:11.720024460 +0200 *************** *** 142,147 **** --- 142,148 ---- :tabclose + " close the next tab page :tabclose 3 " close the third tab page :tabclose $ " close the last tab page + :tabclose # " close the last accessed tab page < *:tabo* *:tabonly* :tabo[nly][!] Close all other tab pages. *************** *** 170,175 **** --- 171,178 ---- " one :tabonly 1 " close all tab pages except the first one :tabonly $ " close all tab pages except the last one + :tabonly # " close all tab pages except the last + " accessed one SWITCHING TO ANOTHER TAB PAGE: *************** *** 192,197 **** --- 195,201 ---- :+2tabnext " go to the two next tab page :1tabnext " go to the first tab page :$tabnext " go to the last tab page + :tabnext # " go to the last accessed tab page :tabnext $ " as above :tabnext - " go to the previous tab page :tabnext -1 " as above *************** *** 255,260 **** --- 259,266 ---- :tabmove " move the tab page to the last :$tabmove " as above :tabmove $ " as above + :tabmove # " move the tab page after the last accessed + " tab page :tabm[ove] +[N] :tabm[ove] -[N] *** ../vim-8.2.1412/src/ex_docmd.c 2020-08-06 22:11:02.565081026 +0200 --- src/ex_docmd.c 2020-08-10 19:00:22.301631109 +0200 *************** *** 5412,5417 **** --- 5412,5426 ---- { if (STRCMP(p, "$") == 0) tab_number = LAST_TAB_NR; + else if (STRCMP(p, "#") == 0) + if (valid_tabpage(lastused_tabpage)) + tab_number = tabpage_index(lastused_tabpage); + else + { + eap->errmsg = ex_errmsg(e_invargval, eap->arg); + tab_number = 0; + goto theend; + } else if (p == p_save || *p_save == '-' || *p != NUL || tab_number > LAST_TAB_NR) { *** ../vim-8.2.1412/src/window.c 2020-08-09 21:45:48.716655399 +0200 --- src/window.c 2020-08-10 19:00:22.301631109 +0200 *************** *** 3844,3849 **** --- 3844,3850 ---- win_new_tabpage(int after) { tabpage_T *tp = curtab; + tabpage_T *prev_tp = curtab; tabpage_T *newtp; int n; *************** *** 3893,3899 **** newtp->tp_topframe = topframe; last_status(FALSE); ! lastused_tabpage = tp; #if defined(FEAT_GUI) // When 'guioptions' includes 'L' or 'R' may have to remove or add --- 3894,3900 ---- newtp->tp_topframe = topframe; last_status(FALSE); ! lastused_tabpage = prev_tp; #if defined(FEAT_GUI) // When 'guioptions' includes 'L' or 'R' may have to remove or add *** ../vim-8.2.1412/src/testdir/test_tabpage.vim 2020-08-09 14:03:51.545367934 +0200 --- src/testdir/test_tabpage.vim 2020-08-10 19:00:22.301631109 +0200 *************** *** 784,789 **** --- 784,790 ---- call assert_beeps('call feedkeys("g\", "xt")') call assert_beeps('call feedkeys("\", "xt")') call assert_beeps('call feedkeys("\g\", "xt")') + call assert_fails('tabnext #', 'E475:') " open four tab pages tabnew *************** *** 808,824 **** call assert_equal(4, tabpagenr()) call assert_equal(2, tabpagenr('#')) " Try to jump to a closed tab page ! tabclose 2 call assert_equal(0, tabpagenr('#')) call feedkeys("g\", "xt") ! call assert_equal(3, tabpagenr()) call feedkeys("\", "xt") ! call assert_equal(3, tabpagenr()) call feedkeys("\g\", "xt") ! call assert_equal(3, tabpagenr()) ! tabclose! endfunc " vim: shiftwidth=2 sts=2 expandtab --- 809,849 ---- call assert_equal(4, tabpagenr()) call assert_equal(2, tabpagenr('#')) + " Test for :tabnext # + tabnext # + call assert_equal(2, tabpagenr()) + call assert_equal(4, tabpagenr('#')) + " Try to jump to a closed tab page ! tabclose # call assert_equal(0, tabpagenr('#')) call feedkeys("g\", "xt") ! call assert_equal(2, tabpagenr()) call feedkeys("\", "xt") ! call assert_equal(2, tabpagenr()) call feedkeys("\g\", "xt") ! call assert_equal(2, tabpagenr()) ! call assert_fails('tabnext #', 'E475:') ! call assert_equal(2, tabpagenr()) ! ! " Test for :tabonly # ! let wnum = win_getid() ! $tabnew ! tabonly # ! call assert_equal(wnum, win_getid()) ! call assert_equal(1, tabpagenr('$')) ! ! " Test for :tabmove # ! tabnew ! let wnum = win_getid() ! tabnew ! tabnew ! tabnext 2 ! tabmove # ! call assert_equal(4, tabpagenr()) ! call assert_equal(wnum, win_getid()) ! tabonly! endfunc " vim: shiftwidth=2 sts=2 expandtab *** ../vim-8.2.1412/src/version.c 2020-08-09 22:17:52.709512974 +0200 --- src/version.c 2020-08-10 19:02:29.885152501 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1413, /**/ -- "Hit any key to continue" is a lie. /// 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 ///