Keep does nothing if an empty regex is entered (rather than crashing)

This commit is contained in:
Maxime Coste 2013-10-26 18:46:21 +01:00
parent cf6c07d37d
commit 29ab42149c

View File

@ -542,6 +542,8 @@ void keep(Context& context, int)
{ {
constexpr const char* prompt = matching ? "keep matching:" : "keep not matching:"; constexpr const char* prompt = matching ? "keep matching:" : "keep not matching:";
regex_prompt(context, prompt, [](const Regex& ex, Context& context) { regex_prompt(context, prompt, [](const Regex& ex, Context& context) {
if (ex.empty())
return;
Editor& editor = context.editor(); Editor& editor = context.editor();
const Buffer& buffer = context.buffer(); const Buffer& buffer = context.buffer();
SelectionList keep; SelectionList keep;