640b8b0
To: vim-dev@vim.org
640b8b0
Subject: patch 7.1.028
640b8b0
Fcc: outbox
640b8b0
From: Bram Moolenaar <Bram@moolenaar.net>
640b8b0
Mime-Version: 1.0
640b8b0
Content-Type: text/plain; charset=ISO-8859-1
640b8b0
Content-Transfer-Encoding: 8bit
640b8b0
------------
640b8b0
640b8b0
Patch 7.1.028
640b8b0
Problem:    Can't use last search pattern for ":sort". (Brian McKee)
640b8b0
Solution:   When the pattern is emtpy use the last search pattern. (Martin
640b8b0
	    Toft)
640b8b0
Files:	    runtime/doc/change.txt, src/ex_cmds.c
640b8b0
640b8b0
640b8b0
*** ../vim-7.1.027/runtime/doc/change.txt	Sat May 12 16:10:12 2007
640b8b0
--- runtime/doc/change.txt	Tue Jul 10 11:30:56 2007
640b8b0
***************
640b8b0
*** 1571,1576 ****
640b8b0
--- 1571,1580 ----
640b8b0
  			in their original order, right before the sorted
640b8b0
  			lines.
640b8b0
  
640b8b0
+ 			If {pattern} is empty (e.g. // is specified), the
640b8b0
+ 			last search pattern is used.  This allows trying out
640b8b0
+ 			a pattern first.
640b8b0
+ 
640b8b0
  Note that using ":sort" with ":global" doesn't sort the matching lines, it's
640b8b0
  quite useless.
640b8b0
  
640b8b0
*** ../vim-7.1.027/src/ex_cmds.c	Thu Jun 28 21:57:08 2007
640b8b0
--- src/ex_cmds.c	Tue Jul 10 17:25:10 2007
640b8b0
***************
640b8b0
*** 408,414 ****
640b8b0
  		goto sortend;
640b8b0
  	    }
640b8b0
  	    *s = NUL;
640b8b0
! 	    regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
640b8b0
  	    if (regmatch.regprog == NULL)
640b8b0
  		goto sortend;
640b8b0
  	    p = s;		/* continue after the regexp */
640b8b0
--- 408,418 ----
640b8b0
  		goto sortend;
640b8b0
  	    }
640b8b0
  	    *s = NUL;
640b8b0
! 	    /* Use last search pattern if sort pattern is empty. */
640b8b0
! 	    if (s == p + 1 && last_search_pat() != NULL)
640b8b0
! 		regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
640b8b0
! 	    else
640b8b0
! 		regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
640b8b0
  	    if (regmatch.regprog == NULL)
640b8b0
  		goto sortend;
640b8b0
  	    p = s;		/* continue after the regexp */
640b8b0
*** ../vim-7.1.027/src/version.c	Tue Jul 10 17:09:51 2007
640b8b0
--- src/version.c	Tue Jul 10 17:20:01 2007
640b8b0
***************
640b8b0
*** 668,669 ****
640b8b0
--- 668,671 ----
640b8b0
  {   /* Add new patch number below this line */
640b8b0
+ /**/
640b8b0
+     28,
640b8b0
  /**/
640b8b0
640b8b0
-- 
640b8b0
Every person is responsible for the choices he makes.
640b8b0
640b8b0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
640b8b0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
640b8b0
\\\        download, build and distribute -- http://www.A-A-P.org        ///
640b8b0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///