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