Karsten Hopp a64b18
To: vim_dev@googlegroups.com
Karsten Hopp a64b18
Subject: Patch 7.3.591
Karsten Hopp a64b18
Fcc: outbox
Karsten Hopp a64b18
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a64b18
Mime-Version: 1.0
Karsten Hopp a64b18
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a64b18
Content-Transfer-Encoding: 8bit
Karsten Hopp a64b18
------------
Karsten Hopp a64b18
Karsten Hopp a64b18
Patch 7.3.591
Karsten Hopp a64b18
Problem:    Can only move to a tab by absolute number.
Karsten Hopp a64b18
Solution:   Move a number of tabs to the left or the right. (Lech Lorens)
Karsten Hopp a64b18
Files:	    runtime/doc/tabpage.txt, src/ex_cmds.h, src/ex_docmd.c,
Karsten Hopp a64b18
	    src/testdir/test62.in, src/testdir/test62.ok, src/window.c
Karsten Hopp a64b18
Karsten Hopp a64b18
Karsten Hopp a64b18
*** ../vim-7.3.590/runtime/doc/tabpage.txt	2010-08-15 21:57:17.000000000 +0200
Karsten Hopp a64b18
--- runtime/doc/tabpage.txt	2012-07-06 18:10:06.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 173,182 ****
Karsten Hopp a64b18
--- 173,192 ----
Karsten Hopp a64b18
  REORDERING TAB PAGES:
Karsten Hopp a64b18
  
Karsten Hopp a64b18
  :tabm[ove] [N]						*:tabm* *:tabmove*
Karsten Hopp a64b18
+ :[N]tabm[ove]
Karsten Hopp a64b18
  		Move the current tab page to after tab page N.  Use zero to
Karsten Hopp a64b18
  		make the current tab page the first one.  Without N the tab
Karsten Hopp a64b18
  		page is made the last one.
Karsten Hopp a64b18
  
Karsten Hopp a64b18
+ :tabm[ove] +[N]
Karsten Hopp a64b18
+ :tabm[ove] -[N]
Karsten Hopp a64b18
+ 		Move the current tab page N places to the right (with +) or to
Karsten Hopp a64b18
+ 		the left (with -).
Karsten Hopp a64b18
+ 
Karsten Hopp a64b18
+ Note that although it is possible to move a tab behind the N-th one by using
Karsten Hopp a64b18
+ :Ntabmove, it is impossible to move it by N places by using :+Ntabmove. For
Karsten Hopp a64b18
+ clarification what +N means in this context see |[range]|.
Karsten Hopp a64b18
+ 
Karsten Hopp a64b18
  
Karsten Hopp a64b18
  LOOPING OVER TAB PAGES:
Karsten Hopp a64b18
  
Karsten Hopp a64b18
*** ../vim-7.3.590/src/ex_cmds.h	2012-05-18 18:47:11.000000000 +0200
Karsten Hopp a64b18
--- src/ex_cmds.h	2012-07-06 18:10:13.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 944,950 ****
Karsten Hopp a64b18
  EX(CMD_tabfirst,	"tabfirst",	ex_tabnext,
Karsten Hopp a64b18
  			TRLBAR),
Karsten Hopp a64b18
  EX(CMD_tabmove,		"tabmove",	ex_tabmove,
Karsten Hopp a64b18
! 			RANGE|NOTADR|ZEROR|COUNT|TRLBAR|ZEROR),
Karsten Hopp a64b18
  EX(CMD_tablast,		"tablast",	ex_tabnext,
Karsten Hopp a64b18
  			TRLBAR),
Karsten Hopp a64b18
  EX(CMD_tabnext,		"tabnext",	ex_tabnext,
Karsten Hopp a64b18
--- 944,950 ----
Karsten Hopp a64b18
  EX(CMD_tabfirst,	"tabfirst",	ex_tabnext,
Karsten Hopp a64b18
  			TRLBAR),
Karsten Hopp a64b18
  EX(CMD_tabmove,		"tabmove",	ex_tabmove,
Karsten Hopp a64b18
! 			RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR),
Karsten Hopp a64b18
  EX(CMD_tablast,		"tablast",	ex_tabnext,
Karsten Hopp a64b18
  			TRLBAR),
Karsten Hopp a64b18
  EX(CMD_tabnext,		"tabnext",	ex_tabnext,
Karsten Hopp a64b18
*** ../vim-7.3.590/src/ex_docmd.c	2012-06-06 19:02:40.000000000 +0200
Karsten Hopp a64b18
--- src/ex_docmd.c	2012-07-06 18:16:25.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 7478,7484 ****
Karsten Hopp a64b18
  ex_tabmove(eap)
Karsten Hopp a64b18
      exarg_T	*eap;
Karsten Hopp a64b18
  {
Karsten Hopp a64b18
!     tabpage_move(eap->addr_count == 0 ? 9999 : (int)eap->line2);
Karsten Hopp a64b18
  }
Karsten Hopp a64b18
  
Karsten Hopp a64b18
  /*
Karsten Hopp a64b18
--- 7478,7519 ----
Karsten Hopp a64b18
  ex_tabmove(eap)
Karsten Hopp a64b18
      exarg_T	*eap;
Karsten Hopp a64b18
  {
Karsten Hopp a64b18
!     int tab_number = 9999;
Karsten Hopp a64b18
! 
Karsten Hopp a64b18
!     if (eap->arg && *eap->arg != NUL)
Karsten Hopp a64b18
!     {
Karsten Hopp a64b18
! 	char_u *p = eap->arg;
Karsten Hopp a64b18
! 	int    relative = 0; /* argument +N/-N means: move N places to the
Karsten Hopp a64b18
! 			      * right/left relative to the current position. */
Karsten Hopp a64b18
! 
Karsten Hopp a64b18
! 	if (*eap->arg == '-')
Karsten Hopp a64b18
! 	{
Karsten Hopp a64b18
! 	    relative = -1;
Karsten Hopp a64b18
! 	    p = eap->arg + 1;
Karsten Hopp a64b18
! 	}
Karsten Hopp a64b18
! 	else if (*eap->arg == '+')
Karsten Hopp a64b18
! 	{
Karsten Hopp a64b18
! 	    relative = 1;
Karsten Hopp a64b18
! 	    p = eap->arg + 1;
Karsten Hopp a64b18
! 	}
Karsten Hopp a64b18
! 	else
Karsten Hopp a64b18
! 	    p = eap->arg;
Karsten Hopp a64b18
! 
Karsten Hopp a64b18
! 	if (p == skipdigits(p))
Karsten Hopp a64b18
! 	{
Karsten Hopp a64b18
! 	    /* No numbers as argument. */
Karsten Hopp a64b18
! 	    eap->errmsg = e_invarg;
Karsten Hopp a64b18
! 	    return;
Karsten Hopp a64b18
! 	}
Karsten Hopp a64b18
! 
Karsten Hopp a64b18
! 	tab_number = getdigits(&p);
Karsten Hopp a64b18
! 	if (relative != 0)
Karsten Hopp a64b18
! 	    tab_number = tab_number * relative + tabpage_index(curtab) - 1;;
Karsten Hopp a64b18
!     }
Karsten Hopp a64b18
!     else if (eap->addr_count != 0)
Karsten Hopp a64b18
! 	tab_number = eap->line2;
Karsten Hopp a64b18
! 
Karsten Hopp a64b18
!     tabpage_move(tab_number);
Karsten Hopp a64b18
  }
Karsten Hopp a64b18
  
Karsten Hopp a64b18
  /*
Karsten Hopp a64b18
*** ../vim-7.3.590/src/testdir/test62.in	2012-03-07 22:55:17.000000000 +0100
Karsten Hopp a64b18
--- src/testdir/test62.in	2012-07-06 18:10:13.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 93,98 ****
Karsten Hopp a64b18
--- 93,126 ----
Karsten Hopp a64b18
  :endif
Karsten Hopp a64b18
  :"
Karsten Hopp a64b18
  :"
Karsten Hopp a64b18
+ :for i in range(9) | tabnew | endfor
Karsten Hopp a64b18
+ 1gt
Karsten Hopp a64b18
+ Go?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove 5
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove -2
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove +4
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove -20
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :tabmove +20
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :3tabmove
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :7tabmove 5
Karsten Hopp a64b18
+ i?=tabpagenr()

?
Karsten Hopp a64b18
+ :let a='No error caught.'
Karsten Hopp a64b18
+ :try
Karsten Hopp a64b18
+ :tabmove foo
Karsten Hopp a64b18
+ :catch E474
Karsten Hopp a64b18
+ :let a='E474 caught.'
Karsten Hopp a64b18
+ :endtry
Karsten Hopp a64b18
+ i?=a
?
Karsten Hopp a64b18
+ :"
Karsten Hopp a64b18
+ :"
Karsten Hopp a64b18
  :/^Results/,$w! test.out
Karsten Hopp a64b18
  :qa!
Karsten Hopp a64b18
  ENDTEST
Karsten Hopp a64b18
*** ../vim-7.3.590/src/testdir/test62.ok	2012-02-22 19:13:00.000000000 +0100
Karsten Hopp a64b18
--- src/testdir/test62.ok	2012-07-06 18:10:13.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 8,10 ****
Karsten Hopp a64b18
--- 8,20 ----
Karsten Hopp a64b18
  tab drop 1: pass
Karsten Hopp a64b18
  tab drop 2: pass
Karsten Hopp a64b18
  tab drop 3: pass
Karsten Hopp a64b18
+ 1
Karsten Hopp a64b18
+ 6
Karsten Hopp a64b18
+ 4
Karsten Hopp a64b18
+ 8
Karsten Hopp a64b18
+ 10
Karsten Hopp a64b18
+ 1
Karsten Hopp a64b18
+ 10
Karsten Hopp a64b18
+ 4
Karsten Hopp a64b18
+ 6
Karsten Hopp a64b18
+ E474 caught.
Karsten Hopp a64b18
*** ../vim-7.3.590/src/window.c	2012-07-06 16:39:43.000000000 +0200
Karsten Hopp a64b18
--- src/window.c	2012-07-06 18:10:13.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 3929,3935 ****
Karsten Hopp a64b18
      }
Karsten Hopp a64b18
  
Karsten Hopp a64b18
      /* Re-insert it at the specified position. */
Karsten Hopp a64b18
!     if (n == 0)
Karsten Hopp a64b18
      {
Karsten Hopp a64b18
  	curtab->tp_next = first_tabpage;
Karsten Hopp a64b18
  	first_tabpage = curtab;
Karsten Hopp a64b18
--- 3929,3935 ----
Karsten Hopp a64b18
      }
Karsten Hopp a64b18
  
Karsten Hopp a64b18
      /* Re-insert it at the specified position. */
Karsten Hopp a64b18
!     if (n <= 0)
Karsten Hopp a64b18
      {
Karsten Hopp a64b18
  	curtab->tp_next = first_tabpage;
Karsten Hopp a64b18
  	first_tabpage = curtab;
Karsten Hopp a64b18
*** ../vim-7.3.590/src/version.c	2012-07-06 17:51:24.000000000 +0200
Karsten Hopp a64b18
--- src/version.c	2012-07-06 18:11:08.000000000 +0200
Karsten Hopp a64b18
***************
Karsten Hopp a64b18
*** 716,717 ****
Karsten Hopp a64b18
--- 716,719 ----
Karsten Hopp a64b18
  {   /* Add new patch number below this line */
Karsten Hopp a64b18
+ /**/
Karsten Hopp a64b18
+     591,
Karsten Hopp a64b18
  /**/
Karsten Hopp a64b18
Karsten Hopp a64b18
-- 
Karsten Hopp a64b18
Bare feet magnetize sharp metal objects so they point upward from the
Karsten Hopp a64b18
floor -- especially in the dark.
Karsten Hopp a64b18
Karsten Hopp a64b18
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a64b18
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a64b18
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a64b18
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///