Patch 7.4.2237
Problem: Can't use "." and "$" with ":tab".
Solution: Support a range for ":tab". (Hirohito Higashi)
Files: runtime/doc/tabpage.txt, src/ex_docmd.c,
src/testdir/test_tabpage.vim
*** ../vim-7.4.2236/runtime/doc/tabpage.txt 2015-09-08 18:46:04.341233631
+0200
--- runtime/doc/tabpage.txt 2016-08-21 18:39:17.503780423 +0200
***************
*** 87,100 ****
Execute {cmd} and when it opens a new window open a new tab
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|:execute| and |:normal|.
! When [count] is omitted the tab page appears after the current
! one.
! When [count] is specified the new tab page comes after tab
! page [count]. Use ":0tab cmd" to get the new tab page as the
! first one.
Examples: >
! :tab split " opens current buffer in new tab page
! :tab help gt " opens tab page with help for "gt"
CTRL-W gf Open a new tab page and edit the file name under the cursor.
See |CTRL-W_gf|.
--- 87,107 ----
Execute {cmd} and when it opens a new window open a new tab
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|:execute| and |:normal|.
! If [count] is given the new tab page appears after the tab
! page [count] otherwise the new tab page will appear after the
! current one.
Examples: >
! :tab split " opens current buffer in new tab page
! :tab help gt " opens tab page with help for "gt"
! :.tab help gt " as above
! :+tab help " opens tab page with help after the next
! " tab page
! :-tab help " opens tab page with help before the
! " current one
! :0tab help " opens tab page with help before the
! " first one
! :$tab help " opens tab page with help after the last
! " one
CTRL-W gf Open a new tab page and edit the file name under the cursor.
See |CTRL-W_gf|.
***************
*** 141,150 ****
given, then they become hidden. But modified buffers are
never abandoned, so changes cannot get lost. >
:tabonly " close all tab pages except the current
:{count}tabo[nly][!]
Close all tab pages except the {count}th one. >
! :.tabonly " one
:-tabonly " close all tab pages except the previous
" one
:+tabonly " close all tab pages except the next one
--- 148,158 ----
given, then they become hidden. But modified buffers are
never abandoned, so changes cannot get lost. >
:tabonly " close all tab pages except the current
+ " one
:{count}tabo[nly][!]
Close all tab pages except the {count}th one. >
! :.tabonly " as above
:-tabonly " close all tab pages except the previous
" one
:+tabonly " close all tab pages except the next one
*** ../vim-7.4.2236/src/ex_docmd.c 2016-07-30 19:39:23.487649548 +0200
--- src/ex_docmd.c 2016-08-21 18:39:17.507780388 +0200
***************
*** 1858,1866 ****
/*
* 2. Handle command modifiers.
*/
! p = ea.cmd;
! if (VIM_ISDIGIT(*ea.cmd))
! p = skipwhite(skipdigits(ea.cmd));
switch (*p)
{
/* When adding an entry, also modify cmd_exists(). */
--- 1858,1864 ----
/*
* 2. Handle command modifiers.
*/
! p = skip_range(ea.cmd, NULL);
switch (*p)
{
/* When adding an entry, also modify cmd_exists(). */
***************
*** 1992,2001 ****
case 't': if (checkforcmd(&p, "tab", 3))
{
#ifdef FEAT_WINDOWS
! if (vim_isdigit(*ea.cmd))
! cmdmod.tab = atoi((char *)ea.cmd) + 1;
! else
cmdmod.tab = tabpage_index(curtab) + 1;
ea.cmd = p;
#endif
continue;
--- 1990,2008 ----
case 't': if (checkforcmd(&p, "tab", 3))
{
#ifdef FEAT_WINDOWS
! long tabnr = get_address(&ea, &ea.cmd, ADDR_TABS,
! ea.skip, FALSE);
! if (tabnr == MAXLNUM)
cmdmod.tab = tabpage_index(curtab) + 1;
+ else
+ {
+ if (tabnr < 0 || tabnr > LAST_TAB_NR)
+ {
+ errormsg = (char_u *)_(e_invrange);
+ goto doend;
+ }
+ cmdmod.tab = tabnr + 1;
+ }
ea.cmd = p;
#endif
continue;
*** ../vim-7.4.2236/src/testdir/test_tabpage.vim 2016-08-18
22:11:27.036228825 +0200
--- src/testdir/test_tabpage.vim 2016-08-21 18:39:17.507780388 +0200
***************
*** 186,189 ****
--- 186,221 ----
bw!
endfunction
+ function Test_tabpage_with_tab_modifier()
+ for n in range(4)
+ tabedit
+ endfor
+
+ function s:check_tab(pre_nr, cmd, post_nr)
+ exec 'tabnext ' . a:pre_nr
+ exec a:cmd
+ call assert_equal(a:post_nr, tabpagenr())
+ call assert_equal('help', &filetype)
+ helpclose
+ endfunc
+
+ call s:check_tab(1, 'tab help', 2)
+ call s:check_tab(1, '3tab help', 4)
+ call s:check_tab(1, '.tab help', 2)
+ call s:check_tab(1, '.+1tab help', 3)
+ call s:check_tab(1, '0tab help', 1)
+ call s:check_tab(2, '+tab help', 4)
+ call s:check_tab(2, '+2tab help', 5)
+ call s:check_tab(4, '-tab help', 4)
+ call s:check_tab(4, '-2tab help', 3)
+ call s:check_tab(3, '$tab help', 6)
+ call assert_fails('99tab help', 'E16:')
+ call assert_fails('+99tab help', 'E16:')
+ call assert_fails('-99tab help', 'E16:')
+
+ delfunction s:check_tab
+ tabonly!
+ bw!
+ endfunction
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-7.4.2236/src/version.c 2016-08-21 17:44:57.440487201 +0200
--- src/version.c 2016-08-21 18:40:38.479059554 +0200
***************
*** 765,766 ****
--- 765,768 ----
{ /* Add new patch number below this line */
+ /**/
+ 2237,
/**/
--
hundred-and-one symptoms of being an internet addict:
42. Your virtual girlfriend finds a new net sweetheart with a larger bandwidth.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.