search: fix empty search string, use previous pattern

This commit is contained in:
Maxime Coste 2013-02-19 19:05:13 +01:00
parent c451dd07c6
commit a83731c8e1

View File

@ -143,7 +143,7 @@ void do_search(Context& context)
{ {
context.editor().select(selections); context.editor().select(selections);
if (str.empty() or event == PromptEvent::Abort) if (event == PromptEvent::Abort)
return; return;
String ex = str; String ex = str;
@ -155,7 +155,7 @@ void do_search(Context& context)
RegisterManager::instance()['/'] = ex; RegisterManager::instance()['/'] = ex;
context.push_jump(); context.push_jump();
} }
else if (not context.options()["incsearch"].as_int()) else if (ex.empty() or not context.options()["incsearch"].as_int())
return; return;
context.editor().select(std::bind(select_next_match<forward>, _1, ex), mode); context.editor().select(std::bind(select_next_match<forward>, _1, ex), mode);