comparison src/ops.c @ 1893:a75120dc3e26 v7.2.190

updated for version 7.2-190
author vimboss
date Tue, 26 May 2009 16:12:37 +0000
parents 720a59d79bcd
children 75a69023117c
comparison
equal deleted inserted replaced
1892:04613e770ec0 1893:a75120dc3e26
1141 y_current->y_type = MCHAR; /* used to be MLINE, why? */ 1141 y_current->y_type = MCHAR; /* used to be MLINE, why? */
1142 } 1142 }
1143 return OK; 1143 return OK;
1144 } 1144 }
1145 1145
1146 static int execreg_lastc = NUL;
1147
1146 /* 1148 /*
1147 * execute a yank register: copy it into the stuff buffer 1149 * execute a yank register: copy it into the stuff buffer
1148 * 1150 *
1149 * return FAIL for failure, OK otherwise 1151 * return FAIL for failure, OK otherwise
1150 */ 1152 */
1153 int regname; 1155 int regname;
1154 int colon; /* insert ':' before each line */ 1156 int colon; /* insert ':' before each line */
1155 int addcr; /* always add '\n' to end of line */ 1157 int addcr; /* always add '\n' to end of line */
1156 int silent; /* set "silent" flag in typeahead buffer */ 1158 int silent; /* set "silent" flag in typeahead buffer */
1157 { 1159 {
1158 static int lastc = NUL;
1159 long i; 1160 long i;
1160 char_u *p; 1161 char_u *p;
1161 int retval = OK; 1162 int retval = OK;
1162 int remap; 1163 int remap;
1163 1164
1164 if (regname == '@') /* repeat previous one */ 1165 if (regname == '@') /* repeat previous one */
1165 { 1166 {
1166 if (lastc == NUL) 1167 if (execreg_lastc == NUL)
1167 { 1168 {
1168 EMSG(_("E748: No previously used register")); 1169 EMSG(_("E748: No previously used register"));
1169 return FAIL; 1170 return FAIL;
1170 } 1171 }
1171 regname = lastc; 1172 regname = execreg_lastc;
1172 } 1173 }
1173 /* check for valid regname */ 1174 /* check for valid regname */
1174 if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE)) 1175 if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
1175 { 1176 {
1176 emsg_invreg(regname); 1177 emsg_invreg(regname);
1177 return FAIL; 1178 return FAIL;
1178 } 1179 }
1179 lastc = regname; 1180 execreg_lastc = regname;
1180 1181
1181 #ifdef FEAT_CLIPBOARD 1182 #ifdef FEAT_CLIPBOARD
1182 regname = may_get_selection(regname); 1183 regname = may_get_selection(regname);
1183 #endif 1184 #endif
1184 1185
5335 char_u *str; 5336 char_u *str;
5336 char_u **array = NULL; 5337 char_u **array = NULL;
5337 5338
5338 /* We only get here (hopefully) if line[0] == '"' */ 5339 /* We only get here (hopefully) if line[0] == '"' */
5339 str = virp->vir_line + 1; 5340 str = virp->vir_line + 1;
5341
5342 /* If the line starts with "" this is the y_previous register. */
5340 if (*str == '"') 5343 if (*str == '"')
5341 { 5344 {
5342 set_prev = TRUE; 5345 set_prev = TRUE;
5343 str++; 5346 str++;
5344 } 5347 }
5348
5345 if (!ASCII_ISALNUM(*str) && *str != '-') 5349 if (!ASCII_ISALNUM(*str) && *str != '-')
5346 { 5350 {
5347 if (viminfo_error("E577: ", _("Illegal register name"), virp->vir_line)) 5351 if (viminfo_error("E577: ", _("Illegal register name"), virp->vir_line))
5348 return TRUE; /* too many errors, pretend end-of-file */ 5352 return TRUE; /* too many errors, pretend end-of-file */
5349 do_it = FALSE; 5353 do_it = FALSE;
5350 } 5354 }
5351 get_yank_register(*str++, FALSE); 5355 get_yank_register(*str++, FALSE);
5352 if (!force && y_current->y_array != NULL) 5356 if (!force && y_current->y_array != NULL)
5353 do_it = FALSE; 5357 do_it = FALSE;
5358
5359 if (*str == '@')
5360 {
5361 /* "x@: register x used for @@ */
5362 if (force || execreg_lastc == NUL)
5363 execreg_lastc = str[-1];
5364 }
5365
5354 size = 0; 5366 size = 0;
5355 limit = 100; /* Optimized for registers containing <= 100 lines */ 5367 limit = 100; /* Optimized for registers containing <= 100 lines */
5356 if (do_it) 5368 if (do_it)
5357 { 5369 {
5358 if (set_prev) 5370 if (set_prev)
5359 y_previous = y_current; 5371 y_previous = y_current;
5360 vim_free(y_current->y_array); 5372 vim_free(y_current->y_array);
5361 array = y_current->y_array = 5373 array = y_current->y_array =
5362 (char_u **)alloc((unsigned)(limit * sizeof(char_u *))); 5374 (char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
5363 str = skipwhite(str); 5375 str = skipwhite(skiptowhite(str));
5364 if (STRNCMP(str, "CHAR", 4) == 0) 5376 if (STRNCMP(str, "CHAR", 4) == 0)
5365 y_current->y_type = MCHAR; 5377 y_current->y_type = MCHAR;
5366 #ifdef FEAT_VISUAL 5378 #ifdef FEAT_VISUAL
5367 else if (STRNCMP(str, "BLOCK", 5) == 0) 5379 else if (STRNCMP(str, "BLOCK", 5) == 0)
5368 y_current->y_type = MBLOCK; 5380 y_current->y_type = MBLOCK;
5441 if (max_num_lines == 0) 5453 if (max_num_lines == 0)
5442 return; 5454 return;
5443 max_kbyte = get_viminfo_parameter('s'); 5455 max_kbyte = get_viminfo_parameter('s');
5444 if (max_kbyte == 0) 5456 if (max_kbyte == 0)
5445 return; 5457 return;
5458
5446 for (i = 0; i < NUM_REGISTERS; i++) 5459 for (i = 0; i < NUM_REGISTERS; i++)
5447 { 5460 {
5448 if (y_regs[i].y_array == NULL) 5461 if (y_regs[i].y_array == NULL)
5449 continue; 5462 continue;
5450 #ifdef FEAT_CLIPBOARD 5463 #ifdef FEAT_CLIPBOARD
5495 break; 5508 break;
5496 } 5509 }
5497 if (y_previous == &y_regs[i]) 5510 if (y_previous == &y_regs[i])
5498 fprintf(fp, "\""); 5511 fprintf(fp, "\"");
5499 c = get_register_name(i); 5512 c = get_register_name(i);
5500 fprintf(fp, "\"%c\t%s\t%d\n", c, type, 5513 fprintf(fp, "\"%c", c);
5514 if (c == execreg_lastc)
5515 fprintf(fp, "@");
5516 fprintf(fp, "\t%s\t%d\n", type,
5501 #ifdef FEAT_VISUAL 5517 #ifdef FEAT_VISUAL
5502 (int)y_regs[i].y_width 5518 (int)y_regs[i].y_width
5503 #else 5519 #else
5504 0 5520 0
5505 #endif 5521 #endif