]> git.pld-linux.org Git - packages/vim.git/blob - 6.2.311
- initial import
[packages/vim.git] / 6.2.311
1 To: vim-dev@vim.org
2 Subject: Patch 6.2.311
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 6.2.311 (after 6.2.298)
11 Problem:    When making several changes in one line the changelist grows
12             quickly.  There is no error message for reaching the end of the
13             changelist.  Reading changelist marks from viminfo doesn't work
14             properly.
15 Solution:   Only make a new entry in the changelist when making a change in
16             another line or 'textwidth' columns away.  Add E662, E663 and E664 
17             error messages.  Put a changelist mark from viminfo one position
18             before the end.
19 Files:      runtime/doc/motion.txt, src/mark.c, src/misc1.c, src/normal.c
20
21
22 *** ../vim-6.2.310/runtime/doc/motion.txt       Sun Feb 29 20:46:43 2004
23 --- runtime/doc/motion.txt      Tue Mar  2 15:29:59 2004
24 ***************
25 *** 1,4 ****
26 ! *motion.txt*    For Vim version 6.2.  Last change: 2004 Feb 29
27   
28   
29                   VIM REFERENCE MANUAL    by Bram Moolenaar
30 --- 1,4 ----
31 ! *motion.txt*    For Vim version 6.2.  Last change: 2004 Mar 02
32   
33   
34                   VIM REFERENCE MANUAL    by Bram Moolenaar
35 ***************
36 *** 960,995 ****
37   stored in the viminfo file and restored when starting Vim.
38   
39   
40 ! CHANGE LIST JUMPS                     *changelist* *change-list-jumps*
41
42 ! For changes the cursor position is remembered.  One position is remembered for
43 ! every change that can be undone.  Two commands can be used to jump to
44 ! positions of changes, also those that have been undone.
45   
46 !                                                       *g;*
47 ! g;                    Go to [count] older cursor position in change list
48 !                       (not a motion command).
49                         {not in Vi}
50                         {not available without the +jumplist feature}
51   
52 !                                                       *g,*
53 ! g,                    Go to [count] newer cursor position in change list
54 !                       (not a motion command).
55                         {not in Vi}
56                         {not available without the +jumplist feature}
57   
58 ! When you already are at the end or start of the change list you will get an
59 ! error message.  When using a count you jump as far back or forward as
60 ! possible.  Thus you can use "999g;" to go to the first change for which the
61 ! position is still remembered.  The number of entries in the change list is
62 ! fixed and is the same as for the |jumplist|.
63   
64   Note that when text has been inserted or deleted the cursor position might be
65 ! a bit different from the position of the change.
66   
67   When the |:keepjumps| command modifier is used the position of a change is not
68   remembered.
69   
70   ==============================================================================
71   9. Various motions                            *various-motions*
72   
73 --- 968,1040 ----
74   stored in the viminfo file and restored when starting Vim.
75   
76   
77 ! CHANGE LIST JUMPS                     *changelist* *change-list-jumps* *E664*
78   
79 ! When making a change the cursor position is remembered.  One position is
80 ! remembered for every change that can be undone, unless it is close to a
81 ! previous change.  Two commands can be used to jump to positions of changes,
82 ! also those that have been undone:
83
84 !                                                       *g;* *E662*
85 ! g;                    Go to [count] older position in change list.
86 !                       If [count] is larger than the number of older change
87 !                       positions go to the oldest change.
88 !                       If there is no older change an error message is given.
89 !                       (not a motion command)
90                         {not in Vi}
91                         {not available without the +jumplist feature}
92   
93 !                                                       *g,* *E663*
94 ! g,                    Go to [count] newer cursor position in change list.
95 !                       Just like "g;| but in the opposite direction.
96 !                       (not a motion command)
97                         {not in Vi}
98                         {not available without the +jumplist feature}
99   
100 ! When using a count you jump as far back or forward as possible.  Thus you can
101 ! use "999g;" to go to the first change for which the position is still
102 ! remembered.  The number of entries in the change list is fixed and is the same
103 ! as for the |jumplist|.
104
105 ! When two undo-able changes are in the same line and at a column position less
106 ! than 'textwidth' apart only the last one is remembered.  This avoids that a
107 ! sequence of small changes in a line, for example "xxxxx", adds many positions
108 ! to the change list.  When 'textwidth' is zero 'wrapmargin' is used.  When that
109 ! also isn't set a fixed number of 79 is used.  Detail: For the computations
110 ! bytes are used, not characters, to avoid a speed penalty (this only matters
111 ! for multi-byte encodings).
112   
113   Note that when text has been inserted or deleted the cursor position might be
114 ! a bit different from the position of the change.  Especially when lines have
115 ! been deleted.
116   
117   When the |:keepjumps| command modifier is used the position of a change is not
118   remembered.
119   
120 +                                                       *:changes*
121 + :changes              Print the change list.  A ">" character indicates the
122 +                       current position.  Just after a change it is below the
123 +                       newest entry, indicating that "g;" takes you to the
124 +                       newest entry position.  The first column indicates the
125 +                       count needed to take you to this position.  Example:
126
127 +                               change line  col text ~
128 +                                   3     9    8 bla bla bla
129 +                                   2    11   57 foo is a bar
130 +                                   1    14   54 the latest changed line
131 +                               >
132
133 +                       The "3g;" command takes you to line 9.  Then the
134 +                       output of ":changes is:
135
136 +                               change line  col text ~
137 +                               >   0     9    8 bla bla bla
138 +                                   1    11   57 foo is a bar
139 +                                   2    14   54 the latest changed line
140 +                       
141 +                       Now you can use "g," to go to line 11 and "2g," to go
142 +                       to line 14.
143
144   ==============================================================================
145   9. Various motions                            *various-motions*
146   
147 *** ../vim-6.2.310/src/mark.c   Sun Feb 29 20:46:43 2004
148 --- src/mark.c  Mon Mar  1 22:42:35 2004
149 ***************
150 *** 898,904 ****
151   #ifdef FEAT_JUMPLIST
152         /* list of change positions */
153         for (i = 0; i < curbuf->b_changelistlen; ++i)
154 !           one_adjust(&(curbuf->b_changelist[i].lnum));
155   #endif
156   
157   #ifdef FEAT_VISUAL
158 --- 898,904 ----
159   #ifdef FEAT_JUMPLIST
160         /* list of change positions */
161         for (i = 0; i < curbuf->b_changelistlen; ++i)
162 !           one_adjust_nodel(&(curbuf->b_changelist[i].lnum));
163   #endif
164   
165   #ifdef FEAT_VISUAL
166 ***************
167 *** 1470,1476 ****
168                                   else
169                                       ++curbuf->b_changelistlen;
170                                   curbuf->b_changelist[
171 !                                              curbuf->b_changelistlen] = pos;
172   #endif
173                                   break;
174                         default:  if ((i = line[1] - 'a') >= 0 && i < NMARKS)
175 --- 1470,1476 ----
176                                   else
177                                       ++curbuf->b_changelistlen;
178                                   curbuf->b_changelist[
179 !                                          curbuf->b_changelistlen - 1] = pos;
180   #endif
181                                   break;
182                         default:  if ((i = line[1] - 'a') >= 0 && i < NMARKS)
183 *** ../vim-6.2.310/src/misc1.c  Sun Feb 29 20:46:43 2004
184 --- src/misc1.c Tue Mar  2 10:48:59 2004
185 ***************
186 *** 2494,2499 ****
187 --- 2501,2511 ----
188   {
189       win_T     *wp;
190       int               i;
191 + #ifdef FEAT_JUMPLIST
192 +     int               cols;
193 +     pos_T     *p;
194 +     int               add;
195 + #endif
196   
197       /* mark the buffer as modified */
198       changed();
199 ***************
200 *** 2505,2539 ****
201         curbuf->b_last_change.col = col;
202   
203   #ifdef FEAT_JUMPLIST
204 !       if (curbuf->b_new_change)
205         {
206 !           /* This is the first of a new sequence of undo-able changes.
207 !            * Use a new position in the changelist. */
208 !           curbuf->b_new_change = FALSE;
209
210 !           if (curbuf->b_changelistlen == JUMPLISTSIZE)
211             {
212 !               /* changelist is full: remove oldest entry */
213 !               curbuf->b_changelistlen = JUMPLISTSIZE - 1;
214 !               mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
215 !                                         sizeof(pos_T) * (JUMPLISTSIZE - 1));
216 !               FOR_ALL_WINDOWS(wp)
217                 {
218 !                   /* Correct position in changelist for other windows on
219 !                    * this buffer. */
220 !                   if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
221 !                       --wp->w_changelistidx;
222                 }
223             }
224 !           FOR_ALL_WINDOWS(wp)
225             {
226 !               /* For other windows, if the position in the changelist is at
227 !                * the end it stays at the end. */
228 !               if (wp->w_buffer == curbuf
229                             && wp->w_changelistidx == curbuf->b_changelistlen)
230 !                   ++wp->w_changelistidx;
231             }
232 -           ++curbuf->b_changelistlen;
233         }
234         curbuf->b_changelist[curbuf->b_changelistlen - 1] =
235                                                         curbuf->b_last_change;
236 --- 2517,2575 ----
237         curbuf->b_last_change.col = col;
238   
239   #ifdef FEAT_JUMPLIST
240 !       /* Create a new entry if a new undo-able change was started or we
241 !        * don't have an entry yet. */
242 !       if (curbuf->b_new_change || curbuf->b_changelistlen == 0)
243         {
244 !           if (curbuf->b_changelistlen == 0)
245 !               add = TRUE;
246 !           else
247             {
248 !               /* Don't create a new entry when the line number is the same
249 !                * as the last one and the column is not too far away.  Avoids
250 !                * creating many entries for typing "xxxxx". */
251 !               p = &curbuf->b_changelist[curbuf->b_changelistlen - 1];
252 !               if (p->lnum != lnum)
253 !                   add = TRUE;
254 !               else
255                 {
256 !                   cols = comp_textwidth(FALSE);
257 !                   if (cols == 0)
258 !                       cols = 79;
259 !                   add = (p->col + cols < col || col + cols < p->col);
260                 }
261             }
262 !           if (add)
263             {
264 !               /* This is the first of a new sequence of undo-able changes
265 !                * and it's at some distance of the last change.  Use a new
266 !                * position in the changelist. */
267 !               curbuf->b_new_change = FALSE;
268
269 !               if (curbuf->b_changelistlen == JUMPLISTSIZE)
270 !               {
271 !                   /* changelist is full: remove oldest entry */
272 !                   curbuf->b_changelistlen = JUMPLISTSIZE - 1;
273 !                   mch_memmove(curbuf->b_changelist, curbuf->b_changelist + 1,
274 !                                         sizeof(pos_T) * (JUMPLISTSIZE - 1));
275 !                   FOR_ALL_WINDOWS(wp)
276 !                   {
277 !                       /* Correct position in changelist for other windows on
278 !                        * this buffer. */
279 !                       if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
280 !                           --wp->w_changelistidx;
281 !                   }
282 !               }
283 !               FOR_ALL_WINDOWS(wp)
284 !               {
285 !                   /* For other windows, if the position in the changelist is
286 !                    * at the end it stays at the end. */
287 !                   if (wp->w_buffer == curbuf
288                             && wp->w_changelistidx == curbuf->b_changelistlen)
289 !                       ++wp->w_changelistidx;
290 !               }
291 !               ++curbuf->b_changelistlen;
292             }
293         }
294         curbuf->b_changelist[curbuf->b_changelistlen - 1] =
295                                                         curbuf->b_last_change;
296 *** ../vim-6.2.310/src/normal.c Mon Mar  1 16:54:50 2004
297 --- src/normal.c        Mon Mar  1 22:30:36 2004
298 ***************
299 *** 6549,6555 ****
300   }
301   
302   /*
303 !  * Handle CTRL-O and CTRL-I commands.
304    */
305       static void
306   nv_pcmark(cap)
307 --- 6549,6555 ----
308   }
309   
310   /*
311 !  * Handle CTRL-O, CTRL-I, "g;" and "g," commands.
312    */
313       static void
314   nv_pcmark(cap)
315 ***************
316 *** 6575,6580 ****
317 --- 6575,6589 ----
318         }
319         else if (pos != NULL)               /* can jump */
320             nv_cursormark(cap, FALSE, pos);
321 +       else if (cap->cmdchar == 'g')
322 +       {
323 +           if (curbuf->b_changelistlen == 0)
324 +               EMSG(_("E664: changelist is empty"));
325 +           else if (cap->count1 < 0)
326 +               EMSG(_("E662: At start of changelist"));
327 +           else
328 +               EMSG(_("E663: At end of changelist"));
329 +       }
330         else
331             clearopbeep(cap->oap);
332   # ifdef FEAT_FOLDING
333 *** ../vim-6.2.310/src/version.c        Tue Mar  2 15:10:20 2004
334 --- src/version.c       Tue Mar  2 15:30:56 2004
335 ***************
336 *** 639,640 ****
337 --- 639,642 ----
338   {   /* Add new patch number below this line */
339 + /**/
340 +     311,
341   /**/
342
343 -- 
344 The early bird gets the worm. If you want something else for
345 breakfast, get up later.
346
347  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
348 ///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
349 \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
350  \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///
This page took 0.060708 seconds and 3 git commands to generate.