Mercurial > vim
changeset 4199:dd669f296568 v7.3.851
updated for version 7.3.851
Problem: Using an empty pattern with :sort silently continues when there is
no previous search pattern.
Solution: Give an error message.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 07 Mar 2013 16:41:30 +0100 |
parents | 905ca4bac044 |
children | 606423157270 |
files | src/ex_cmds.c src/version.c |
diffstat | 2 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -415,8 +415,15 @@ ex_sort(eap) } *s = NUL; /* Use last search pattern if sort pattern is empty. */ - if (s == p + 1 && last_search_pat() != NULL) + 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)