To: vim-dev@vim.org Subject: Patch 7.2.190 Fcc: outbox From: Bram Moolenaar 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 ///