From 29ab42149cf0f5c9cb629878cb29417fd9f298cc Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 26 Oct 2013 18:46:21 +0100 Subject: [PATCH] Keep does nothing if an empty regex is entered (rather than crashing) --- src/normal.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/normal.cc b/src/normal.cc index 7f2c95687..004745444 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -542,6 +542,8 @@ void keep(Context& context, int) { constexpr const char* prompt = matching ? "keep matching:" : "keep not matching:"; regex_prompt(context, prompt, [](const Regex& ex, Context& context) { + if (ex.empty()) + return; Editor& editor = context.editor(); const Buffer& buffer = context.buffer(); SelectionList keep;