Karsten Hopp 172c1c
To: vim_dev@googlegroups.com
Karsten Hopp 172c1c
Subject: Patch 7.3.074
Karsten Hopp 172c1c
Fcc: outbox
Karsten Hopp 172c1c
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 172c1c
Mime-Version: 1.0
Karsten Hopp 172c1c
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 172c1c
Content-Transfer-Encoding: 8bit
Karsten Hopp 172c1c
------------
Karsten Hopp 172c1c
Karsten Hopp 172c1c
Patch 7.3.074
Karsten Hopp 172c1c
Problem:    Can't use the "+ register like "* for yank and put.
Karsten Hopp 172c1c
Solution:   Add "unnamedplus" to the 'clipboard' option. (Ivan Krasilnikov)
Karsten Hopp 172c1c
Files:	    runtime/doc/options.txt, src/eval.c, src/globals.h, src/ops.c,
Karsten Hopp 172c1c
	    src/option.c
Karsten Hopp 172c1c
Karsten Hopp 172c1c
Karsten Hopp 172c1c
*** ../vim-7.3.073/runtime/doc/options.txt	2010-12-02 16:01:23.000000000 +0100
Karsten Hopp 172c1c
--- runtime/doc/options.txt	2010-12-02 21:22:48.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 1434,1439 ****
Karsten Hopp 172c1c
--- 1434,1448 ----
Karsten Hopp 172c1c
  			explicitly accessed using the "* notation.  Also see
Karsten Hopp 172c1c
  			|gui-clipboard|.
Karsten Hopp 172c1c
  
Karsten Hopp 172c1c
+ 	unnamedplus	A variant of "unnamed" flag which uses the clipboard
Karsten Hopp 172c1c
+ 			register '+' (|quoteplus|) instead of register '*' for
Karsten Hopp 172c1c
+ 			all operations except yank.  Yank shall copy the text
Karsten Hopp 172c1c
+ 			into register '+' and also into '*' when "unnamed" is
Karsten Hopp 172c1c
+ 			included.
Karsten Hopp 172c1c
+ 			Only available with the |+x11| feature.
Karsten Hopp 172c1c
+ 			Availability can be checked with: >
Karsten Hopp 172c1c
+ 				if has('unnamedplus')
Karsten Hopp 172c1c
+ <
Karsten Hopp 172c1c
  	autoselect	Works like the 'a' flag in 'guioptions': If present,
Karsten Hopp 172c1c
  			then whenever Visual mode is started, or the Visual
Karsten Hopp 172c1c
  			area extended, Vim tries to become the owner of the
Karsten Hopp 172c1c
*** ../vim-7.3.073/src/eval.c	2010-12-02 14:47:56.000000000 +0100
Karsten Hopp 172c1c
--- src/eval.c	2010-12-02 17:30:23.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 12135,12140 ****
Karsten Hopp 172c1c
--- 12139,12147 ----
Karsten Hopp 172c1c
  #ifdef FEAT_TOOLBAR
Karsten Hopp 172c1c
  	"toolbar",
Karsten Hopp 172c1c
  #endif
Karsten Hopp 172c1c
+ #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
Karsten Hopp 172c1c
+ 	"unnamedplus",
Karsten Hopp 172c1c
+ #endif
Karsten Hopp 172c1c
  #ifdef FEAT_USR_CMDS
Karsten Hopp 172c1c
  	"user-commands",    /* was accidentally included in 5.4 */
Karsten Hopp 172c1c
  	"user_commands",
Karsten Hopp 172c1c
*** ../vim-7.3.073/src/globals.h	2010-11-24 14:28:53.000000000 +0100
Karsten Hopp 172c1c
--- src/globals.h	2010-12-02 20:07:42.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 512,518 ****
Karsten Hopp 172c1c
  #  define clip_plus clip_star	/* there is only one clipboard */
Karsten Hopp 172c1c
  #  define ONE_CLIPBOARD
Karsten Hopp 172c1c
  # endif
Karsten Hopp 172c1c
! EXTERN int	clip_unnamed INIT(= FALSE);
Karsten Hopp 172c1c
  EXTERN int	clip_autoselect INIT(= FALSE);
Karsten Hopp 172c1c
  EXTERN int	clip_autoselectml INIT(= FALSE);
Karsten Hopp 172c1c
  EXTERN int	clip_html INIT(= FALSE);
Karsten Hopp 172c1c
--- 512,522 ----
Karsten Hopp 172c1c
  #  define clip_plus clip_star	/* there is only one clipboard */
Karsten Hopp 172c1c
  #  define ONE_CLIPBOARD
Karsten Hopp 172c1c
  # endif
Karsten Hopp 172c1c
! 
Karsten Hopp 172c1c
! #define CLIP_UNNAMED      1
Karsten Hopp 172c1c
! #define CLIP_UNNAMED_PLUS 2
Karsten Hopp 172c1c
! EXTERN int	clip_unnamed INIT(= 0); /* above two values or'ed */
Karsten Hopp 172c1c
! 
Karsten Hopp 172c1c
  EXTERN int	clip_autoselect INIT(= FALSE);
Karsten Hopp 172c1c
  EXTERN int	clip_autoselectml INIT(= FALSE);
Karsten Hopp 172c1c
  EXTERN int	clip_html INIT(= FALSE);
Karsten Hopp 172c1c
*** ../vim-7.3.073/src/ops.c	2010-11-24 14:28:53.000000000 +0100
Karsten Hopp 172c1c
--- src/ops.c	2010-12-02 21:33:04.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 1584,1592 ****
Karsten Hopp 172c1c
  adjust_clip_reg(rp)
Karsten Hopp 172c1c
      int		*rp;
Karsten Hopp 172c1c
  {
Karsten Hopp 172c1c
!     /* If no reg. specified, and "unnamed" is in 'clipboard', use '*' reg. */
Karsten Hopp 172c1c
!     if (*rp == 0 && clip_unnamed)
Karsten Hopp 172c1c
! 	*rp = '*';
Karsten Hopp 172c1c
      if (!clip_star.available && *rp == '*')
Karsten Hopp 172c1c
  	*rp = 0;
Karsten Hopp 172c1c
      if (!clip_plus.available && *rp == '+')
Karsten Hopp 172c1c
--- 1584,1594 ----
Karsten Hopp 172c1c
  adjust_clip_reg(rp)
Karsten Hopp 172c1c
      int		*rp;
Karsten Hopp 172c1c
  {
Karsten Hopp 172c1c
!     /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard',
Karsten Hopp 172c1c
!      * use '*' or '+' reg, respectively. "unnamedplus" prevails. */
Karsten Hopp 172c1c
!     if (*rp == 0 && clip_unnamed != 0)
Karsten Hopp 172c1c
! 	*rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available)
Karsten Hopp 172c1c
! 								  ? '+' : '*';
Karsten Hopp 172c1c
      if (!clip_star.available && *rp == '*')
Karsten Hopp 172c1c
  	*rp = 0;
Karsten Hopp 172c1c
      if (!clip_plus.available && *rp == '+')
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 2842,2847 ****
Karsten Hopp 172c1c
--- 2844,2850 ----
Karsten Hopp 172c1c
      char_u		*p;
Karsten Hopp 172c1c
      char_u		*pnew;
Karsten Hopp 172c1c
      struct block_def	bd;
Karsten Hopp 172c1c
+     int			did_star = FALSE;
Karsten Hopp 172c1c
  
Karsten Hopp 172c1c
  				    /* check for read-only register */
Karsten Hopp 172c1c
      if (oap->regname != 0 && !valid_yank_reg(oap->regname, TRUE))
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 3115,3121 ****
Karsten Hopp 172c1c
       */
Karsten Hopp 172c1c
      if (clip_star.available
Karsten Hopp 172c1c
  	    && (curr == &(y_regs[STAR_REGISTER])
Karsten Hopp 172c1c
! 		|| (!deleting && oap->regname == 0 && clip_unnamed)))
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
  	if (curr != &(y_regs[STAR_REGISTER]))
Karsten Hopp 172c1c
  	    /* Copy the text from register 0 to the clipboard register. */
Karsten Hopp 172c1c
--- 3118,3125 ----
Karsten Hopp 172c1c
       */
Karsten Hopp 172c1c
      if (clip_star.available
Karsten Hopp 172c1c
  	    && (curr == &(y_regs[STAR_REGISTER])
Karsten Hopp 172c1c
! 		|| (!deleting && oap->regname == 0
Karsten Hopp 172c1c
! 					   && (clip_unnamed & CLIP_UNNAMED))))
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
  	if (curr != &(y_regs[STAR_REGISTER]))
Karsten Hopp 172c1c
  	    /* Copy the text from register 0 to the clipboard register. */
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 3123,3128 ****
Karsten Hopp 172c1c
--- 3127,3133 ----
Karsten Hopp 172c1c
  
Karsten Hopp 172c1c
  	clip_own_selection(&clip_star);
Karsten Hopp 172c1c
  	clip_gen_set_selection(&clip_star);
Karsten Hopp 172c1c
+ 	did_star = TRUE;
Karsten Hopp 172c1c
      }
Karsten Hopp 172c1c
  
Karsten Hopp 172c1c
  # ifdef FEAT_X11
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 3130,3141 ****
Karsten Hopp 172c1c
       * If we were yanking to the '+' register, send result to selection.
Karsten Hopp 172c1c
       * Also copy to the '*' register, in case auto-select is off.
Karsten Hopp 172c1c
       */
Karsten Hopp 172c1c
!     else if (clip_plus.available && curr == &(y_regs[PLUS_REGISTER]))
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
  	/* No need to copy to * register upon 'unnamed' now - see below */
Karsten Hopp 172c1c
  	clip_own_selection(&clip_plus);
Karsten Hopp 172c1c
  	clip_gen_set_selection(&clip_plus);
Karsten Hopp 172c1c
! 	if (!clip_isautosel())
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
  	    copy_yank_reg(&(y_regs[STAR_REGISTER]));
Karsten Hopp 172c1c
  	    clip_own_selection(&clip_star);
Karsten Hopp 172c1c
--- 3135,3153 ----
Karsten Hopp 172c1c
       * If we were yanking to the '+' register, send result to selection.
Karsten Hopp 172c1c
       * Also copy to the '*' register, in case auto-select is off.
Karsten Hopp 172c1c
       */
Karsten Hopp 172c1c
!     if (clip_plus.available
Karsten Hopp 172c1c
! 	    && (curr == &(y_regs[PLUS_REGISTER])
Karsten Hopp 172c1c
! 		|| (!deleting && oap->regname == 0
Karsten Hopp 172c1c
! 				      && (clip_unnamed & CLIP_UNNAMED_PLUS))))
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
+ 	if (curr != &(y_regs[PLUS_REGISTER]))
Karsten Hopp 172c1c
+ 	    /* Copy the text from register 0 to the clipboard register. */
Karsten Hopp 172c1c
+ 	    copy_yank_reg(&(y_regs[PLUS_REGISTER]));
Karsten Hopp 172c1c
+ 
Karsten Hopp 172c1c
  	/* No need to copy to * register upon 'unnamed' now - see below */
Karsten Hopp 172c1c
  	clip_own_selection(&clip_plus);
Karsten Hopp 172c1c
  	clip_gen_set_selection(&clip_plus);
Karsten Hopp 172c1c
! 	if (!clip_isautosel() && !did_star)
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
  	    copy_yank_reg(&(y_regs[STAR_REGISTER]));
Karsten Hopp 172c1c
  	    clip_own_selection(&clip_star);
Karsten Hopp 172c1c
*** ../vim-7.3.073/src/option.c	2010-12-02 16:01:23.000000000 +0100
Karsten Hopp 172c1c
--- src/option.c	2010-12-02 21:41:32.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 7307,7313 ****
Karsten Hopp 172c1c
      static char_u *
Karsten Hopp 172c1c
  check_clipboard_option()
Karsten Hopp 172c1c
  {
Karsten Hopp 172c1c
!     int		new_unnamed = FALSE;
Karsten Hopp 172c1c
      int		new_autoselect = FALSE;
Karsten Hopp 172c1c
      int		new_autoselectml = FALSE;
Karsten Hopp 172c1c
      int		new_html = FALSE;
Karsten Hopp 172c1c
--- 7307,7313 ----
Karsten Hopp 172c1c
      static char_u *
Karsten Hopp 172c1c
  check_clipboard_option()
Karsten Hopp 172c1c
  {
Karsten Hopp 172c1c
!     int		new_unnamed = 0;
Karsten Hopp 172c1c
      int		new_autoselect = FALSE;
Karsten Hopp 172c1c
      int		new_autoselectml = FALSE;
Karsten Hopp 172c1c
      int		new_html = FALSE;
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 7319,7327 ****
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
  	if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
! 	    new_unnamed = TRUE;
Karsten Hopp 172c1c
  	    p += 7;
Karsten Hopp 172c1c
  	}
Karsten Hopp 172c1c
  	else if (STRNCMP(p, "autoselect", 10) == 0
Karsten Hopp 172c1c
  					&& (p[10] == ',' || p[10] == NUL))
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
--- 7319,7333 ----
Karsten Hopp 172c1c
      {
Karsten Hopp 172c1c
  	if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
! 	    new_unnamed |= CLIP_UNNAMED;
Karsten Hopp 172c1c
  	    p += 7;
Karsten Hopp 172c1c
  	}
Karsten Hopp 172c1c
+         else if (STRNCMP(p, "unnamedplus", 11) == 0
Karsten Hopp 172c1c
+ 					    && (p[11] == ',' || p[11] == NUL))
Karsten Hopp 172c1c
+ 	{
Karsten Hopp 172c1c
+ 	    new_unnamed |= CLIP_UNNAMED_PLUS;
Karsten Hopp 172c1c
+ 	    p += 11;
Karsten Hopp 172c1c
+ 	}
Karsten Hopp 172c1c
  	else if (STRNCMP(p, "autoselect", 10) == 0
Karsten Hopp 172c1c
  					&& (p[10] == ',' || p[10] == NUL))
Karsten Hopp 172c1c
  	{
Karsten Hopp 172c1c
*** ../vim-7.3.073/src/version.c	2010-12-02 17:09:48.000000000 +0100
Karsten Hopp 172c1c
--- src/version.c	2010-12-02 21:34:40.000000000 +0100
Karsten Hopp 172c1c
***************
Karsten Hopp 172c1c
*** 716,717 ****
Karsten Hopp 172c1c
--- 716,719 ----
Karsten Hopp 172c1c
  {   /* Add new patch number below this line */
Karsten Hopp 172c1c
+ /**/
Karsten Hopp 172c1c
+     74,
Karsten Hopp 172c1c
  /**/
Karsten Hopp 172c1c
Karsten Hopp 172c1c
-- 
Karsten Hopp 172c1c
The budget process was invented by an alien race of sadistic beings who
Karsten Hopp 172c1c
resemble large cats.
Karsten Hopp 172c1c
				(Scott Adams - The Dilbert principle)
Karsten Hopp 172c1c
Karsten Hopp 172c1c
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 172c1c
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 172c1c
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 172c1c
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///