]> git.pld-linux.org Git - packages/vim.git/blob - 7.2.048
- new
[packages/vim.git] / 7.2.048
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
98 !               /* multiply with ca.opcount the same way as below */
99 !               if (ca.opcount != 0)
100 !                   count = ca.opcount * (count == 0 ? 1 : count);
101 !               set_vcount(count, count == 0 ? 1 : count, set_prevcount);
102 !               set_prevcount = FALSE;  /* only set v:prevcount once */
103 !           }
104   #endif
105             if (ctrl_w)
106             {
107 ***************
108 *** 806,812 ****
109        * Only set v:count when called from main() and not a stuffed command.
110        */
111       if (toplevel && stuff_empty())
112 !       set_vcount(ca.count0, ca.count1);
113   #endif
114   
115       /*
116 --- 822,828 ----
117        * Only set v:count when called from main() and not a stuffed command.
118        */
119       if (toplevel && stuff_empty())
120 !       set_vcount(ca.count0, ca.count1, set_prevcount);
121   #endif
122   
123       /*
124 *** ../vim-7.2.047/src/proto/eval.pro   Sun Nov  9 13:43:25 2008
125 --- src/proto/eval.pro  Thu Nov 20 15:53:54 2008
126 ***************
127 *** 61,67 ****
128   long get_vim_var_nr __ARGS((int idx));
129   char_u *get_vim_var_str __ARGS((int idx));
130   list_T *get_vim_var_list __ARGS((int idx));
131 ! void set_vcount __ARGS((long count, long count1));
132   void set_vim_var_string __ARGS((int idx, char_u *val, int len));
133   void set_vim_var_list __ARGS((int idx, list_T *val));
134   void set_reg_var __ARGS((int c));
135 --- 61,67 ----
136   long get_vim_var_nr __ARGS((int idx));
137   char_u *get_vim_var_str __ARGS((int idx));
138   list_T *get_vim_var_list __ARGS((int idx));
139 ! void set_vcount __ARGS((long count, long count1, int set_prevcount));
140   void set_vim_var_string __ARGS((int idx, char_u *val, int len));
141   void set_vim_var_list __ARGS((int idx, list_T *val));
142   void set_reg_var __ARGS((int c));
143 *** ../vim-7.2.047/src/version.c        Thu Nov 20 14:11:47 2008
144 --- src/version.c       Thu Nov 20 16:08:19 2008
145 ***************
146 *** 678,679 ****
147 --- 678,681 ----
148   {   /* Add new patch number below this line */
149 + /**/
150 +     48,
151   /**/
152
153 -- 
154 Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
155 "Embrace and extend"...?
156
157  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
158 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
159 \\\        download, build and distribute -- http://www.A-A-P.org        ///
160  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.045814 seconds and 3 git commands to generate.