diff --git a/src/input_handler.cc b/src/input_handler.cc index 794a9f5a..8f9e20f4 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -968,7 +968,8 @@ private: { display(); 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)) m_idle_timer.set_next_date(Clock::now() + get_idle_timeout(context())); diff --git a/src/normal.cc b/src/normal.cc index bd399dc9..50062632 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -718,7 +718,8 @@ void regex_prompt(Context& context, String prompt, String default_regex, T func) if (event == PromptEvent::Validate) context.push_jump(); - func(str.empty() ? Regex{default_regex} : Regex{str}, event, context); + if (not str.empty() or event == PromptEvent::Validate) + func(str.empty() ? Regex{default_regex} : Regex{str}, event, context); } catch (regex_error& err) {