do_select: do not propagate errors on incremental search
This commit is contained in:
parent
892b65b355
commit
e36bc74f43
13
src/main.cc
13
src/main.cc
|
@ -137,6 +137,8 @@ void do_search(Context& context)
|
|||
SelectionList selections = context.editor().selections();
|
||||
context.input_handler().prompt("/", complete_nothing,
|
||||
[selections](const String& str, PromptEvent event, Context& context) {
|
||||
try
|
||||
{
|
||||
context.editor().select(selections);
|
||||
|
||||
if (str.empty() or event == PromptEvent::Abort)
|
||||
|
@ -151,7 +153,18 @@ void do_search(Context& context)
|
|||
RegisterManager::instance()['/'] = ex;
|
||||
context.push_jump();
|
||||
}
|
||||
|
||||
context.editor().select(std::bind(select_next_match, _1, ex), mode);
|
||||
}
|
||||
catch (runtime_error&)
|
||||
{
|
||||
context.editor().select(selections);
|
||||
// only validation should propagate errors,
|
||||
// incremental search should not.
|
||||
if (event == PromptEvent::Validate)
|
||||
throw;
|
||||
}
|
||||
|
||||
}, context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user