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.147 < prev    next >
Encoding:
Internet Message Format  |  2003-11-08  |  2.2 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.2.147
  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.147
  11. Problem:    ":s/pat/\=col('.')" always replaces with "1".
  12. Solution:   Set the cursor to the start of the match before substituting.
  13.         (Helmut Stiegler)
  14. Files:        src/ex_cmds.c
  15.  
  16.  
  17. *** ../vim-6.2.146/src/ex_cmds.c    Sat Sep 27 19:36:46 2003
  18. --- src/ex_cmds.c    Fri Nov  7 16:12:26 2003
  19. ***************
  20. *** 3896,3904 ****
  21.               break;
  22.           }
  23.   
  24. !         /* Move the cursor to the start of the line, to avoid that it
  25. !          * is beyond the end of the line after the substitution. */
  26. !         curwin->w_cursor.col = 0;
  27.   
  28.           /*
  29.            * 3. substitute the string.
  30. --- 3896,3904 ----
  31.               break;
  32.           }
  33.   
  34. !         /* Move the cursor to the start of the match, so that we can
  35. !          * use "\=col("."). */
  36. !         curwin->w_cursor.col = regmatch.startpos[0].col;
  37.   
  38.           /*
  39.            * 3. substitute the string.
  40. ***************
  41. *** 3970,3975 ****
  42. --- 3970,3979 ----
  43.                          sub, new_end, TRUE, p_magic, TRUE);
  44.           sub_nsubs++;
  45.           did_sub = TRUE;
  46. +         /* Move the cursor to the start of the line, to avoid that it
  47. +          * is beyond the end of the line after the substitution. */
  48. +         curwin->w_cursor.col = 0;
  49.   
  50.           /* For a multi-line match, make a copy of the last matched
  51.            * line and continue in that one. */
  52. *** ../vim-6.2.146/src/version.c    Sun Nov  9 20:20:26 2003
  53. --- src/version.c    Sun Nov  9 20:22:20 2003
  54. ***************
  55. *** 639,640 ****
  56. --- 639,642 ----
  57.   {   /* Add new patch number below this line */
  58. + /**/
  59. +     147,
  60.   /**/
  61.  
  62. -- 
  63. I once paid $12 to peer at the box that held King Tutankhamen's little
  64. bandage-covered midget corpse at the De Young Museum in San Francisco.  I
  65. remember thinking how pleased he'd be about the way things turned out in his
  66. afterlife.
  67.                 (Scott Adams - The Dilbert principle)
  68.  
  69.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  70. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  71. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  72.  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///
  73.