summaryrefslogtreecommitdiffstats
path: root/gvim/vim-7.2/7.2.190
blob: 2a0aee98eefe42c88977bf12a20ec21a206394c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
To: vim-dev@vim.org
Subject: Patch 7.2.190
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.190
Problem:    The register executed by @@ isn't restored.
Solution:   Mark the executable register in the viminfo file.
Files:	    src/ops.c


*** ../vim-7.2.189/src/ops.c	2009-05-13 12:46:36.000000000 +0200
--- src/ops.c	2009-05-26 18:05:23.000000000 +0200
***************
*** 1143,1148 ****
--- 1143,1150 ----
      return OK;
  }
  
+ static int execreg_lastc = NUL;
+ 
  /*
   * execute a yank register: copy it into the stuff buffer
   *
***************
*** 1155,1161 ****
      int	    addcr;		/* always add '\n' to end of line */
      int	    silent;		/* set "silent" flag in typeahead buffer */
  {
-     static int	lastc = NUL;
      long	i;
      char_u	*p;
      int		retval = OK;
--- 1157,1162 ----
***************
*** 1163,1174 ****
  
      if (regname == '@')			/* repeat previous one */
      {
! 	if (lastc == NUL)
  	{
  	    EMSG(_("E748: No previously used register"));
  	    return FAIL;
  	}
! 	regname = lastc;
      }
  					/* check for valid regname */
      if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
--- 1164,1175 ----
  
      if (regname == '@')			/* repeat previous one */
      {
! 	if (execreg_lastc == NUL)
  	{
  	    EMSG(_("E748: No previously used register"));
  	    return FAIL;
  	}
! 	regname = execreg_lastc;
      }
  					/* check for valid regname */
      if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
***************
*** 1176,1182 ****
  	emsg_invreg(regname);
  	return FAIL;
      }
!     lastc = regname;
  
  #ifdef FEAT_CLIPBOARD
      regname = may_get_selection(regname);
--- 1177,1183 ----
  	emsg_invreg(regname);
  	return FAIL;
      }
!     execreg_lastc = regname;
  
  #ifdef FEAT_CLIPBOARD
      regname = may_get_selection(regname);
***************
*** 5337,5347 ****
--- 5338,5351 ----
  
      /* We only get here (hopefully) if line[0] == '"' */
      str = virp->vir_line + 1;
+ 
+     /* If the line starts with "" this is the y_previous register. */
      if (*str == '"')
      {
  	set_prev = TRUE;
  	str++;
      }
+ 
      if (!ASCII_ISALNUM(*str) && *str != '-')
      {
  	if (viminfo_error("E577: ", _("Illegal register name"), virp->vir_line))
***************
*** 5351,5356 ****
--- 5355,5368 ----
      get_yank_register(*str++, FALSE);
      if (!force && y_current->y_array != NULL)
  	do_it = FALSE;
+ 
+     if (*str == '@')
+     {
+ 	/* "x@: register x used for @@ */
+ 	if (force || execreg_lastc == NUL)
+ 	    execreg_lastc = str[-1];
+     }
+ 
      size = 0;
      limit = 100;	/* Optimized for registers containing <= 100 lines */
      if (do_it)
***************
*** 5360,5366 ****
  	vim_free(y_current->y_array);
  	array = y_current->y_array =
  		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
! 	str = skipwhite(str);
  	if (STRNCMP(str, "CHAR", 4) == 0)
  	    y_current->y_type = MCHAR;
  #ifdef FEAT_VISUAL
--- 5372,5378 ----
  	vim_free(y_current->y_array);
  	array = y_current->y_array =
  		       (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
! 	str = skipwhite(skiptowhite(str));
  	if (STRNCMP(str, "CHAR", 4) == 0)
  	    y_current->y_type = MCHAR;
  #ifdef FEAT_VISUAL
***************
*** 5443,5448 ****
--- 5455,5461 ----
      max_kbyte = get_viminfo_parameter('s');
      if (max_kbyte == 0)
  	return;
+ 
      for (i = 0; i < NUM_REGISTERS; i++)
      {
  	if (y_regs[i].y_array == NULL)
***************
*** 5497,5503 ****
  	if (y_previous == &y_regs[i])
  	    fprintf(fp, "\"");
  	c = get_register_name(i);
! 	fprintf(fp, "\"%c\t%s\t%d\n", c, type,
  #ifdef FEAT_VISUAL
  		    (int)y_regs[i].y_width
  #else
--- 5510,5519 ----
  	if (y_previous == &y_regs[i])
  	    fprintf(fp, "\"");
  	c = get_register_name(i);
! 	fprintf(fp, "\"%c", c);
! 	if (c == execreg_lastc)
! 	    fprintf(fp, "@");
! 	fprintf(fp, "\t%s\t%d\n", type,
  #ifdef FEAT_VISUAL
  		    (int)y_regs[i].y_width
  #else
*** ../vim-7.2.189/src/version.c	2009-05-26 11:01:43.000000000 +0200
--- src/version.c	2009-05-26 18:10:13.000000000 +0200
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     190,
  /**/

-- 
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///