home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.2 / 7.2.190 < prev    next >
Encoding:
Internet Message Format  |  2009-05-25  |  4.7 KB

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