components/vim/vim72-patches/7.2.190
changeset 198 172fc01ce997
equal deleted inserted replaced
197:fd801ec0737c 198:172fc01ce997
       
     1 To: [email protected]
       
     2 Subject: Patch 7.2.190
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=UTF-8
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.190
       
    11 Problem:    The register executed by @@ isn't restored.
       
    12 Solution:   Mark the executable register in the viminfo file.
       
    13 Files:	    src/ops.c
       
    14 
       
    15 
       
    16 *** ../vim-7.2.189/src/ops.c	2009-05-13 12:46:36.000000000 +0200
       
    17 --- src/ops.c	2009-05-26 18:05:23.000000000 +0200
       
    18 ***************
       
    19 *** 1143,1148 ****
       
    20 --- 1143,1150 ----
       
    21       return OK;
       
    22   }
       
    23   
       
    24 + static int execreg_lastc = NUL;
       
    25 + 
       
    26   /*
       
    27    * execute a yank register: copy it into the stuff buffer
       
    28    *
       
    29 ***************
       
    30 *** 1155,1161 ****
       
    31       int	    addcr;		/* always add '\n' to end of line */
       
    32       int	    silent;		/* set "silent" flag in typeahead buffer */
       
    33   {
       
    34 -     static int	lastc = NUL;
       
    35       long	i;
       
    36       char_u	*p;
       
    37       int		retval = OK;
       
    38 --- 1157,1162 ----
       
    39 ***************
       
    40 *** 1163,1174 ****
       
    41   
       
    42       if (regname == '@')			/* repeat previous one */
       
    43       {
       
    44 ! 	if (lastc == NUL)
       
    45   	{
       
    46   	    EMSG(_("E748: No previously used register"));
       
    47   	    return FAIL;
       
    48   	}
       
    49 ! 	regname = lastc;
       
    50       }
       
    51   					/* check for valid regname */
       
    52       if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
       
    53 --- 1164,1175 ----
       
    54   
       
    55       if (regname == '@')			/* repeat previous one */
       
    56       {
       
    57 ! 	if (execreg_lastc == NUL)
       
    58   	{
       
    59   	    EMSG(_("E748: No previously used register"));
       
    60   	    return FAIL;
       
    61   	}
       
    62 ! 	regname = execreg_lastc;
       
    63       }
       
    64   					/* check for valid regname */
       
    65       if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
       
    66 ***************
       
    67 *** 1176,1182 ****
       
    68   	emsg_invreg(regname);
       
    69   	return FAIL;
       
    70       }
       
    71 !     lastc = regname;
       
    72   
       
    73   #ifdef FEAT_CLIPBOARD
       
    74       regname = may_get_selection(regname);
       
    75 --- 1177,1183 ----
       
    76   	emsg_invreg(regname);
       
    77   	return FAIL;
       
    78       }
       
    79 !     execreg_lastc = regname;
       
    80   
       
    81   #ifdef FEAT_CLIPBOARD
       
    82       regname = may_get_selection(regname);
       
    83 ***************
       
    84 *** 5337,5347 ****
       
    85 --- 5338,5351 ----
       
    86   
       
    87       /* We only get here (hopefully) if line[0] == '"' */
       
    88       str = virp->vir_line + 1;
       
    89 + 
       
    90 +     /* If the line starts with "" this is the y_previous register. */
       
    91       if (*str == '"')
       
    92       {
       
    93   	set_prev = TRUE;
       
    94   	str++;
       
    95       }
       
    96 + 
       
    97       if (!ASCII_ISALNUM(*str) && *str != '-')
       
    98       {
       
    99   	if (viminfo_error("E577: ", _("Illegal register name"), virp->vir_line))
       
   100 ***************
       
   101 *** 5351,5356 ****
       
   102 --- 5355,5368 ----
       
   103       get_yank_register(*str++, FALSE);
       
   104       if (!force && y_current->y_array != NULL)
       
   105   	do_it = FALSE;
       
   106 + 
       
   107 +     if (*str == '@')
       
   108 +     {
       
   109 + 	/* "x@: register x used for @@ */
       
   110 + 	if (force || execreg_lastc == NUL)
       
   111 + 	    execreg_lastc = str[-1];
       
   112 +     }
       
   113 + 
       
   114       size = 0;
       
   115       limit = 100;	/* Optimized for registers containing <= 100 lines */
       
   116       if (do_it)
       
   117 ***************
       
   118 *** 5360,5366 ****
       
   119   	vim_free(y_current->y_array);
       
   120   	array = y_current->y_array =
       
   121   		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
       
   122 ! 	str = skipwhite(str);
       
   123   	if (STRNCMP(str, "CHAR", 4) == 0)
       
   124   	    y_current->y_type = MCHAR;
       
   125   #ifdef FEAT_VISUAL
       
   126 --- 5372,5378 ----
       
   127   	vim_free(y_current->y_array);
       
   128   	array = y_current->y_array =
       
   129   		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
       
   130 ! 	str = skipwhite(skiptowhite(str));
       
   131   	if (STRNCMP(str, "CHAR", 4) == 0)
       
   132   	    y_current->y_type = MCHAR;
       
   133   #ifdef FEAT_VISUAL
       
   134 ***************
       
   135 *** 5443,5448 ****
       
   136 --- 5455,5461 ----
       
   137       max_kbyte = get_viminfo_parameter('s');
       
   138       if (max_kbyte == 0)
       
   139   	return;
       
   140 + 
       
   141       for (i = 0; i < NUM_REGISTERS; i++)
       
   142       {
       
   143   	if (y_regs[i].y_array == NULL)
       
   144 ***************
       
   145 *** 5497,5503 ****
       
   146   	if (y_previous == &y_regs[i])
       
   147   	    fprintf(fp, "\"");
       
   148   	c = get_register_name(i);
       
   149 ! 	fprintf(fp, "\"%c\t%s\t%d\n", c, type,
       
   150   #ifdef FEAT_VISUAL
       
   151   		    (int)y_regs[i].y_width
       
   152   #else
       
   153 --- 5510,5519 ----
       
   154   	if (y_previous == &y_regs[i])
       
   155   	    fprintf(fp, "\"");
       
   156   	c = get_register_name(i);
       
   157 ! 	fprintf(fp, "\"%c", c);
       
   158 ! 	if (c == execreg_lastc)
       
   159 ! 	    fprintf(fp, "@");
       
   160 ! 	fprintf(fp, "\t%s\t%d\n", type,
       
   161   #ifdef FEAT_VISUAL
       
   162   		    (int)y_regs[i].y_width
       
   163   #else
       
   164 *** ../vim-7.2.189/src/version.c	2009-05-26 11:01:43.000000000 +0200
       
   165 --- src/version.c	2009-05-26 18:10:13.000000000 +0200
       
   166 ***************
       
   167 *** 678,679 ****
       
   168 --- 678,681 ----
       
   169   {   /* Add new patch number below this line */
       
   170 + /**/
       
   171 +     190,
       
   172   /**/
       
   173 
       
   174 -- 
       
   175 If you had to identify, in one word, the reason why the
       
   176 human race has not achieved, and never will achieve, its
       
   177 full potential, that word would be "meetings."
       
   178 
       
   179  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
   180 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
   181 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
   182  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///