Do not auto apply the fallback regex when in regex prompts

Fixes #1653
This commit is contained in:
Maxime Coste 2017-10-30 17:56:32 +11:00
parent cd215ccee9
commit 6d78b06405
2 changed files with 4 additions and 2 deletions

View File

@ -968,7 +968,8 @@ private:
{ {
display(); display();
m_line_changed = false; m_line_changed = false;
m_callback(m_line_editor.line(), PromptEvent::Change, context()); m_callback((m_flags & PromptFlags::InactiveInitString) ? StringView{} : m_line_editor.line(),
PromptEvent::Change, context());
if (not (context().flags() & Context::Flags::Transient)) if (not (context().flags() & Context::Flags::Transient))
m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context()));

View File

@ -718,6 +718,7 @@ void regex_prompt(Context& context, String prompt, String default_regex, T func)
if (event == PromptEvent::Validate) if (event == PromptEvent::Validate)
context.push_jump(); context.push_jump();
if (not str.empty() or event == PromptEvent::Validate)
func(str.empty() ? Regex{default_regex} : Regex{str}, event, context); func(str.empty() ? Regex{default_regex} : Regex{str}, event, context);
} }
catch (regex_error& err) catch (regex_error& err)