4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
19 Files: runtime/doc/motion.txt, src/mark.c, src/misc1.c, src/normal.c
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
26 ! *motion.txt* For Vim version 6.2. Last change: 2004 Feb 29
29 VIM REFERENCE MANUAL by Bram Moolenaar
31 ! *motion.txt* For Vim version 6.2. Last change: 2004 Mar 02
34 VIM REFERENCE MANUAL by Bram Moolenaar
37 stored in the viminfo file and restored when starting Vim.
40 ! CHANGE LIST JUMPS *changelist* *change-list-jumps*
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.
47 ! g; Go to [count] older cursor position in change list
48 ! (not a motion command).
50 {not available without the +jumplist feature}
53 ! g, Go to [count] newer cursor position in change list
54 ! (not a motion command).
56 {not available without the +jumplist feature}
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|.
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.
67 When the |:keepjumps| command modifier is used the position of a change is not
70 ==============================================================================
71 9. Various motions *various-motions*
74 stored in the viminfo file and restored when starting Vim.
77 ! CHANGE LIST JUMPS *changelist* *change-list-jumps* *E664*
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:
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)
91 {not available without the +jumplist feature}
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)
98 {not available without the +jumplist feature}
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|.
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).
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
117 When the |:keepjumps| command modifier is used the position of a change is not
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:
127 + change line col text ~
129 + 2 11 57 foo is a bar
130 + 1 14 54 the latest changed line
133 + The "3g;" command takes you to line 9. Then the
134 + output of ":changes is:
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
141 + Now you can use "g," to go to line 11 and "2g," to go
144 ==============================================================================
145 9. Various motions *various-motions*
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
152 /* list of change positions */
153 for (i = 0; i < curbuf->b_changelistlen; ++i)
154 ! one_adjust(&(curbuf->b_changelist[i].lnum));
160 /* list of change positions */
161 for (i = 0; i < curbuf->b_changelistlen; ++i)
162 ! one_adjust_nodel(&(curbuf->b_changelist[i].lnum));
169 ++curbuf->b_changelistlen;
170 curbuf->b_changelist[
171 ! curbuf->b_changelistlen] = pos;
174 default: if ((i = line[1] - 'a') >= 0 && i < NMARKS)
177 ++curbuf->b_changelistlen;
178 curbuf->b_changelist[
179 ! curbuf->b_changelistlen - 1] = pos;
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
191 + #ifdef FEAT_JUMPLIST
197 /* mark the buffer as modified */
201 curbuf->b_last_change.col = col;
204 ! if (curbuf->b_new_change)
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;
210 ! if (curbuf->b_changelistlen == JUMPLISTSIZE)
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)
218 ! /* Correct position in changelist for other windows on
220 ! if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
221 ! --wp->w_changelistidx;
224 ! FOR_ALL_WINDOWS(wp)
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;
232 - ++curbuf->b_changelistlen;
234 curbuf->b_changelist[curbuf->b_changelistlen - 1] =
235 curbuf->b_last_change;
237 curbuf->b_last_change.col = col;
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)
244 ! if (curbuf->b_changelistlen == 0)
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)
256 ! cols = comp_textwidth(FALSE);
259 ! add = (p->col + cols < col || col + cols < p->col);
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;
269 ! if (curbuf->b_changelistlen == JUMPLISTSIZE)
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)
277 ! /* Correct position in changelist for other windows on
279 ! if (wp->w_buffer == curbuf && wp->w_changelistidx > 0)
280 ! --wp->w_changelistidx;
283 ! FOR_ALL_WINDOWS(wp)
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;
291 ! ++curbuf->b_changelistlen;
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
303 ! * Handle CTRL-O and CTRL-I commands.
311 ! * Handle CTRL-O, CTRL-I, "g;" and "g," commands.
319 else if (pos != NULL) /* can jump */
320 nv_cursormark(cap, FALSE, pos);
321 + else if (cap->cmdchar == 'g')
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"));
328 + EMSG(_("E663: At end of changelist"));
331 clearopbeep(cap->oap);
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
338 { /* Add new patch number below this line */
344 The early bird gets the worm. If you want something else for
345 breakfast, get up later.
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 ///