| To: vim-dev@vim.org |
| Subject: patch 7.1.028 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| 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 |
| |
| |
| |
| |
| |
| *** 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. |
| |
| |
| |
| |
| *** 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 */ |
| |
| |
| |
| *** 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 /// |