Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.851
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.851
Problem:    Using an empty pattern with :sort silently continues when there is
	    no previous search pattern.
Solution:   Give an error message.
Files:	    src/ex_cmds.c


*** ../vim-7.3.850/src/ex_cmds.c	2013-03-07 16:08:31.000000000 +0100
--- src/ex_cmds.c	2013-03-07 16:25:28.000000000 +0100
***************
*** 415,422 ****
  	    }
  	    *s = NUL;
  	    /* Use last search pattern if sort pattern is empty. */
! 	    if (s == p + 1 && last_search_pat() != NULL)
  		regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
  	    else
  		regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
  	    if (regmatch.regprog == NULL)
--- 415,429 ----
  	    }
  	    *s = NUL;
  	    /* Use last search pattern if sort pattern is empty. */
! 	    if (s == p + 1)
! 	    {
! 		if (last_search_pat() == NULL)
! 		{
! 		    EMSG(_(e_noprevre));
! 		    goto sortend;
! 		}
  		regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
+ 	    }
  	    else
  		regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
  	    if (regmatch.regprog == NULL)
*** ../vim-7.3.850/src/version.c	2013-03-07 16:32:49.000000000 +0100
--- src/version.c	2013-03-07 16:38:49.000000000 +0100
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     851,
  /**/

-- 
This planet has -- or rather had -- a problem, which was this: most
of the people living on it were unhappy for pretty much of the time.
Many solutions were suggested for this problem, but most of these
were largely concerned with the movements of small green pieces of
paper, which is odd because on the whole it wasn't the small green
pieces of paper that were unhappy.
		-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///