aca858b
To: vim-dev@vim.org
aca858b
Subject: Patch 7.2.408
aca858b
Fcc: outbox
aca858b
From: Bram Moolenaar <Bram@moolenaar.net>
aca858b
Mime-Version: 1.0
aca858b
Content-Type: text/plain; charset=UTF-8
aca858b
Content-Transfer-Encoding: 8bit
aca858b
------------
aca858b
aca858b
Patch 7.2.408
aca858b
Problem:    With ":g/the/s/foo/bar/" the '[ and '] marks can be set to a line
aca858b
	    that was not changed.
aca858b
Solution:   Only set '[ and '] marks when a substitution was done.
aca858b
Files:	    src/ex_cmds.c
aca858b
aca858b
aca858b
*** ../vim-7.2.407/src/ex_cmds.c	2009-07-09 20:06:30.000000000 +0200
aca858b
--- src/ex_cmds.c	2010-03-23 17:31:17.000000000 +0100
aca858b
***************
aca858b
*** 4238,4243 ****
aca858b
--- 4238,4244 ----
aca858b
      char_u	*sub_firstline;		/* allocated copy of first sub line */
aca858b
      int		endcolumn = FALSE;	/* cursor in last column when done */
aca858b
      pos_T	old_cursor = curwin->w_cursor;
aca858b
+     int		start_nsubs;
aca858b
  
aca858b
      cmd = eap->arg;
aca858b
      if (!global_busy)
aca858b
***************
aca858b
*** 4245,4250 ****
aca858b
--- 4246,4252 ----
aca858b
  	sub_nsubs = 0;
aca858b
  	sub_nlines = 0;
aca858b
      }
aca858b
+     start_nsubs = sub_nsubs;
aca858b
  
aca858b
      if (eap->cmdidx == CMD_tilde)
aca858b
  	which_pat = RE_LAST;	/* use last used regexp */
aca858b
***************
aca858b
*** 5106,5112 ****
aca858b
      if (do_count)
aca858b
  	curwin->w_cursor = old_cursor;
aca858b
  
aca858b
!     if (sub_nsubs)
aca858b
      {
aca858b
  	/* Set the '[ and '] marks. */
aca858b
  	curbuf->b_op_start.lnum = eap->line1;
aca858b
--- 5108,5114 ----
aca858b
      if (do_count)
aca858b
  	curwin->w_cursor = old_cursor;
aca858b
  
aca858b
!     if (sub_nsubs > start_nsubs)
aca858b
      {
aca858b
  	/* Set the '[ and '] marks. */
aca858b
  	curbuf->b_op_start.lnum = eap->line1;
aca858b
*** ../vim-7.2.407/src/version.c	2010-03-23 16:27:15.000000000 +0100
aca858b
--- src/version.c	2010-03-23 17:35:40.000000000 +0100
aca858b
***************
aca858b
*** 683,684 ****
aca858b
--- 683,686 ----
aca858b
  {   /* Add new patch number below this line */
aca858b
+ /**/
aca858b
+     408,
aca858b
  /**/
aca858b
aca858b
-- 
aca858b
Permission is granted to read this message out aloud on Kings Cross Road,
aca858b
London, under the condition that the orator is properly dressed.
aca858b
aca858b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
aca858b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
aca858b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
aca858b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///