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