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

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

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

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

?
Karsten Hopp 899dbb
+ :tabmove
Karsten Hopp 899dbb
+ i?=tabpagenr()

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

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

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

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

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