From 42be2b23cac2dc2627bd3cadeaf38aef714f53a1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 13 May 2013 14:28:03 +0200 Subject: [PATCH] fix regex prompt whith empty regex --- src/normal.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 796db658..9bebd2d2 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -386,7 +386,7 @@ void regex_prompt(Context& context, const String prompt, T on_validate) { try { - on_validate(Regex{str}, context); + on_validate(str.empty() ? Regex{} : Regex{str}, context); } catch (boost::regex_error& err) { @@ -408,7 +408,7 @@ void select_regex(Context& context) ex = Regex{RegisterManager::instance()['/'].values(context)[0]}; else RegisterManager::instance()['/'] = String{ex.str()}; - if (not ex.empty()) + if (not ex.empty() and not ex.str().empty()) context.editor().multi_select(std::bind(select_all_matches, _1, ex)); }); } @@ -420,7 +420,7 @@ void split_regex(Context& context) ex = Regex{RegisterManager::instance()['/'].values(context)[0]}; else RegisterManager::instance()['/'] = String{ex.str()}; - if (not ex.empty()) + if (not ex.empty() and not ex.str().empty()) context.editor().multi_select(std::bind(split_selection, _1, ex)); }); }