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 / 6.2.311 < prev    next >
Encoding:
Internet Message Format  |  2004-03-01  |  11.2 KB

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