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.048 < prev    next >
Encoding:
Internet Message Format  |  2008-11-19  |  4.6 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.048
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.2.048
  11. Problem:    v:prevcount is changed too often.  Counts are not multiplied when
  12.         setting v:count.
  13. Solution:   Set v:prevcount properly.  Multiply counts. (idea by Ben Schmidt)
  14. Files:        src/eval.c, src/normal.c, src/proto/eval.pro
  15.  
  16.  
  17. *** ../vim-7.2.047/src/eval.c    Thu Nov 20 10:36:04 2008
  18. --- src/eval.c    Thu Nov 20 15:53:47 2008
  19. ***************
  20. *** 18146,18159 ****
  21.   }
  22.   
  23.   /*
  24. !  * Set v:count, v:count1 and v:prevcount.
  25.    */
  26.       void
  27. ! set_vcount(count, count1)
  28.       long    count;
  29.       long    count1;
  30.   {
  31. !     vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
  32.       vimvars[VV_COUNT].vv_nr = count;
  33.       vimvars[VV_COUNT1].vv_nr = count1;
  34.   }
  35. --- 18146,18162 ----
  36.   }
  37.   
  38.   /*
  39. !  * Set v:count to "count" and v:count1 to "count1".
  40. !  * When "set_prevcount" is TRUE first set v:prevcount from v:count.
  41.    */
  42.       void
  43. ! set_vcount(count, count1, set_prevcount)
  44.       long    count;
  45.       long    count1;
  46. +     int        set_prevcount;
  47.   {
  48. !     if (set_prevcount)
  49. !     vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
  50.       vimvars[VV_COUNT].vv_nr = count;
  51.       vimvars[VV_COUNT1].vv_nr = count1;
  52.   }
  53. *** ../vim-7.2.047/src/normal.c    Sat Nov 15 14:10:23 2008
  54. --- src/normal.c    Thu Nov 20 16:04:44 2008
  55. ***************
  56. *** 580,585 ****
  57. --- 580,588 ----
  58.       static int    old_mapped_len = 0;
  59.   #endif
  60.       int        idx;
  61. + #ifdef FEAT_EVAL
  62. +     int        set_prevcount = FALSE;
  63. + #endif
  64.   
  65.       vim_memset(&ca, 0, sizeof(ca));    /* also resets ca.retval */
  66.       ca.oap = oap;
  67. ***************
  68. *** 615,621 ****
  69. --- 618,629 ----
  70.       /* When not finishing an operator and no register name typed, reset the
  71.        * count. */
  72.       if (!finish_op && !oap->regname)
  73. +     {
  74.       ca.opcount = 0;
  75. + #ifdef FEAT_EVAL
  76. +     set_prevcount = TRUE;
  77. + #endif
  78. +     }
  79.   
  80.   #ifdef FEAT_AUTOCMD
  81.       /* Restore counts from before receiving K_CURSORHOLD.  This means after
  82. ***************
  83. *** 719,725 ****
  84.            * command, so that v:count can be used in an expression mapping
  85.            * right after the count. */
  86.           if (toplevel && stuff_empty())
  87. !         set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
  88.   #endif
  89.           if (ctrl_w)
  90.           {
  91. --- 727,741 ----
  92.            * command, so that v:count can be used in an expression mapping
  93.            * right after the count. */
  94.           if (toplevel && stuff_empty())
  95. !         {
  96. !         long count = ca.count0;
  97. !         /* multiply with ca.opcount the same way as below */
  98. !         if (ca.opcount != 0)
  99. !             count = ca.opcount * (count == 0 ? 1 : count);
  100. !         set_vcount(count, count == 0 ? 1 : count, set_prevcount);
  101. !         set_prevcount = FALSE;  /* only set v:prevcount once */
  102. !         }
  103.   #endif
  104.           if (ctrl_w)
  105.           {
  106. ***************
  107. *** 806,812 ****
  108.        * Only set v:count when called from main() and not a stuffed command.
  109.        */
  110.       if (toplevel && stuff_empty())
  111. !     set_vcount(ca.count0, ca.count1);
  112.   #endif
  113.   
  114.       /*
  115. --- 822,828 ----
  116.        * Only set v:count when called from main() and not a stuffed command.
  117.        */
  118.       if (toplevel && stuff_empty())
  119. !     set_vcount(ca.count0, ca.count1, set_prevcount);
  120.   #endif
  121.   
  122.       /*
  123. *** ../vim-7.2.047/src/proto/eval.pro    Sun Nov  9 13:43:25 2008
  124. --- src/proto/eval.pro    Thu Nov 20 15:53:54 2008
  125. ***************
  126. *** 61,67 ****
  127.   long get_vim_var_nr __ARGS((int idx));
  128.   char_u *get_vim_var_str __ARGS((int idx));
  129.   list_T *get_vim_var_list __ARGS((int idx));
  130. ! void set_vcount __ARGS((long count, long count1));
  131.   void set_vim_var_string __ARGS((int idx, char_u *val, int len));
  132.   void set_vim_var_list __ARGS((int idx, list_T *val));
  133.   void set_reg_var __ARGS((int c));
  134. --- 61,67 ----
  135.   long get_vim_var_nr __ARGS((int idx));
  136.   char_u *get_vim_var_str __ARGS((int idx));
  137.   list_T *get_vim_var_list __ARGS((int idx));
  138. ! void set_vcount __ARGS((long count, long count1, int set_prevcount));
  139.   void set_vim_var_string __ARGS((int idx, char_u *val, int len));
  140.   void set_vim_var_list __ARGS((int idx, list_T *val));
  141.   void set_reg_var __ARGS((int c));
  142. *** ../vim-7.2.047/src/version.c    Thu Nov 20 14:11:47 2008
  143. --- src/version.c    Thu Nov 20 16:08:19 2008
  144. ***************
  145. *** 678,679 ****
  146. --- 678,681 ----
  147.   {   /* Add new patch number below this line */
  148. + /**/
  149. +     48,
  150.   /**/
  151.  
  152. -- 
  153. Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
  154. "Embrace and extend"...?
  155.  
  156.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  157. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  158. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  159.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  160.