81c2858
To: vim-dev@vim.org
81c2858
Subject: Patch 7.2.190
81c2858
Fcc: outbox
81c2858
From: Bram Moolenaar <Bram@moolenaar.net>
81c2858
Mime-Version: 1.0
81c2858
Content-Type: text/plain; charset=UTF-8
81c2858
Content-Transfer-Encoding: 8bit
81c2858
------------
81c2858
81c2858
Patch 7.2.190
81c2858
Problem:    The register executed by @@ isn't restored.
81c2858
Solution:   Mark the executable register in the viminfo file.
81c2858
Files:	    src/ops.c
81c2858
81c2858
81c2858
*** ../vim-7.2.189/src/ops.c	2009-05-13 12:46:36.000000000 +0200
81c2858
--- src/ops.c	2009-05-26 18:05:23.000000000 +0200
81c2858
***************
81c2858
*** 1143,1148 ****
81c2858
--- 1143,1150 ----
81c2858
      return OK;
81c2858
  }
81c2858
  
81c2858
+ static int execreg_lastc = NUL;
81c2858
+ 
81c2858
  /*
81c2858
   * execute a yank register: copy it into the stuff buffer
81c2858
   *
81c2858
***************
81c2858
*** 1155,1161 ****
81c2858
      int	    addcr;		/* always add '\n' to end of line */
81c2858
      int	    silent;		/* set "silent" flag in typeahead buffer */
81c2858
  {
81c2858
-     static int	lastc = NUL;
81c2858
      long	i;
81c2858
      char_u	*p;
81c2858
      int		retval = OK;
81c2858
--- 1157,1162 ----
81c2858
***************
81c2858
*** 1163,1174 ****
81c2858
  
81c2858
      if (regname == '@')			/* repeat previous one */
81c2858
      {
81c2858
! 	if (lastc == NUL)
81c2858
  	{
81c2858
  	    EMSG(_("E748: No previously used register"));
81c2858
  	    return FAIL;
81c2858
  	}
81c2858
! 	regname = lastc;
81c2858
      }
81c2858
  					/* check for valid regname */
81c2858
      if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
81c2858
--- 1164,1175 ----
81c2858
  
81c2858
      if (regname == '@')			/* repeat previous one */
81c2858
      {
81c2858
! 	if (execreg_lastc == NUL)
81c2858
  	{
81c2858
  	    EMSG(_("E748: No previously used register"));
81c2858
  	    return FAIL;
81c2858
  	}
81c2858
! 	regname = execreg_lastc;
81c2858
      }
81c2858
  					/* check for valid regname */
81c2858
      if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
81c2858
***************
81c2858
*** 1176,1182 ****
81c2858
  	emsg_invreg(regname);
81c2858
  	return FAIL;
81c2858
      }
81c2858
!     lastc = regname;
81c2858
  
81c2858
  #ifdef FEAT_CLIPBOARD
81c2858
      regname = may_get_selection(regname);
81c2858
--- 1177,1183 ----
81c2858
  	emsg_invreg(regname);
81c2858
  	return FAIL;
81c2858
      }
81c2858
!     execreg_lastc = regname;
81c2858
  
81c2858
  #ifdef FEAT_CLIPBOARD
81c2858
      regname = may_get_selection(regname);
81c2858
***************
81c2858
*** 5337,5347 ****
81c2858
--- 5338,5351 ----
81c2858
  
81c2858
      /* We only get here (hopefully) if line[0] == '"' */
81c2858
      str = virp->vir_line + 1;
81c2858
+ 
81c2858
+     /* If the line starts with "" this is the y_previous register. */
81c2858
      if (*str == '"')
81c2858
      {
81c2858
  	set_prev = TRUE;
81c2858
  	str++;
81c2858
      }
81c2858
+ 
81c2858
      if (!ASCII_ISALNUM(*str) && *str != '-')
81c2858
      {
81c2858
  	if (viminfo_error("E577: ", _("Illegal register name"), virp->vir_line))
81c2858
***************
81c2858
*** 5351,5356 ****
81c2858
--- 5355,5368 ----
81c2858
      get_yank_register(*str++, FALSE);
81c2858
      if (!force && y_current->y_array != NULL)
81c2858
  	do_it = FALSE;
81c2858
+ 
81c2858
+     if (*str == '@')
81c2858
+     {
81c2858
+ 	/* "x@: register x used for @@ */
81c2858
+ 	if (force || execreg_lastc == NUL)
81c2858
+ 	    execreg_lastc = str[-1];
81c2858
+     }
81c2858
+ 
81c2858
      size = 0;
81c2858
      limit = 100;	/* Optimized for registers containing <= 100 lines */
81c2858
      if (do_it)
81c2858
***************
81c2858
*** 5360,5366 ****
81c2858
  	vim_free(y_current->y_array);
81c2858
  	array = y_current->y_array =
81c2858
  		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
81c2858
! 	str = skipwhite(str);
81c2858
  	if (STRNCMP(str, "CHAR", 4) == 0)
81c2858
  	    y_current->y_type = MCHAR;
81c2858
  #ifdef FEAT_VISUAL
81c2858
--- 5372,5378 ----
81c2858
  	vim_free(y_current->y_array);
81c2858
  	array = y_current->y_array =
81c2858
  		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
81c2858
! 	str = skipwhite(skiptowhite(str));
81c2858
  	if (STRNCMP(str, "CHAR", 4) == 0)
81c2858
  	    y_current->y_type = MCHAR;
81c2858
  #ifdef FEAT_VISUAL
81c2858
***************
81c2858
*** 5443,5448 ****
81c2858
--- 5455,5461 ----
81c2858
      max_kbyte = get_viminfo_parameter('s');
81c2858
      if (max_kbyte == 0)
81c2858
  	return;
81c2858
+ 
81c2858
      for (i = 0; i < NUM_REGISTERS; i++)
81c2858
      {
81c2858
  	if (y_regs[i].y_array == NULL)
81c2858
***************
81c2858
*** 5497,5503 ****
81c2858
  	if (y_previous == &y_regs[i])
81c2858
  	    fprintf(fp, "\"");
81c2858
  	c = get_register_name(i);
81c2858
! 	fprintf(fp, "\"%c\t%s\t%d\n", c, type,
81c2858
  #ifdef FEAT_VISUAL
81c2858
  		    (int)y_regs[i].y_width
81c2858
  #else
81c2858
--- 5510,5519 ----
81c2858
  	if (y_previous == &y_regs[i])
81c2858
  	    fprintf(fp, "\"");
81c2858
  	c = get_register_name(i);
81c2858
! 	fprintf(fp, "\"%c", c);
81c2858
! 	if (c == execreg_lastc)
81c2858
! 	    fprintf(fp, "@");
81c2858
! 	fprintf(fp, "\t%s\t%d\n", type,
81c2858
  #ifdef FEAT_VISUAL
81c2858
  		    (int)y_regs[i].y_width
81c2858
  #else
81c2858
*** ../vim-7.2.189/src/version.c	2009-05-26 11:01:43.000000000 +0200
81c2858
--- src/version.c	2009-05-26 18:10:13.000000000 +0200
81c2858
***************
81c2858
*** 678,679 ****
81c2858
--- 678,681 ----
81c2858
  {   /* Add new patch number below this line */
81c2858
+ /**/
81c2858
+     190,
81c2858
  /**/
81c2858
81c2858
-- 
81c2858
If you had to identify, in one word, the reason why the
81c2858
human race has not achieved, and never will achieve, its
81c2858
full potential, that word would be "meetings."
81c2858
81c2858
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
81c2858
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
81c2858
\\\        download, build and distribute -- http://www.A-A-P.org        ///
81c2858
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///