forked from aniani/vim
updated for version 7.2-190
This commit is contained in:
28
src/ops.c
28
src/ops.c
@@ -1143,6 +1143,8 @@ stuff_yank(regname, p)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int execreg_lastc = NUL;
|
||||
|
||||
/*
|
||||
* execute a yank register: copy it into the stuff buffer
|
||||
*
|
||||
@@ -1155,7 +1157,6 @@ do_execreg(regname, colon, addcr, silent)
|
||||
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;
|
||||
@@ -1163,12 +1164,12 @@ do_execreg(regname, colon, addcr, silent)
|
||||
|
||||
if (regname == '@') /* repeat previous one */
|
||||
{
|
||||
if (lastc == NUL)
|
||||
if (execreg_lastc == NUL)
|
||||
{
|
||||
EMSG(_("E748: No previously used register"));
|
||||
return FAIL;
|
||||
}
|
||||
regname = lastc;
|
||||
regname = execreg_lastc;
|
||||
}
|
||||
/* check for valid regname */
|
||||
if (regname == '%' || regname == '#' || !valid_yank_reg(regname, FALSE))
|
||||
@@ -1176,7 +1177,7 @@ do_execreg(regname, colon, addcr, silent)
|
||||
emsg_invreg(regname);
|
||||
return FAIL;
|
||||
}
|
||||
lastc = regname;
|
||||
execreg_lastc = regname;
|
||||
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
regname = may_get_selection(regname);
|
||||
@@ -5337,11 +5338,14 @@ read_viminfo_register(virp, force)
|
||||
|
||||
/* 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,6 +5355,14 @@ read_viminfo_register(virp, force)
|
||||
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,7 +5372,7 @@ read_viminfo_register(virp, force)
|
||||
vim_free(y_current->y_array);
|
||||
array = y_current->y_array =
|
||||
(char_u **)alloc((unsigned)(limit * sizeof(char_u *)));
|
||||
str = skipwhite(str);
|
||||
str = skipwhite(skiptowhite(str));
|
||||
if (STRNCMP(str, "CHAR", 4) == 0)
|
||||
y_current->y_type = MCHAR;
|
||||
#ifdef FEAT_VISUAL
|
||||
@@ -5443,6 +5455,7 @@ write_viminfo_registers(fp)
|
||||
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,7 +5510,10 @@ write_viminfo_registers(fp)
|
||||
if (y_previous == &y_regs[i])
|
||||
fprintf(fp, "\"");
|
||||
c = get_register_name(i);
|
||||
fprintf(fp, "\"%c\t%s\t%d\n", c, type,
|
||||
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
|
||||
|
Reference in New Issue
Block a user