Mercurial > vim
changeset 1314:afad99b3612c v7.1.028
updated for version 7.1-028
author | vimboss |
---|---|
date | Tue, 10 Jul 2007 15:26:20 +0000 |
parents | dbd226be80b1 |
children | 0868e4e53fb2 |
files | runtime/doc/change.txt src/ex_cmds.c src/version.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1571,6 +1571,10 @@ found here: |sort()|. 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.
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -408,7 +408,11 @@ ex_sort(eap) goto sortend; } *s = NUL; - regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); + /* 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 */