diff --git a/src/context.hh b/src/context.hh index 7ff4166e..fb45fc2d 100644 --- a/src/context.hh +++ b/src/context.hh @@ -108,7 +108,7 @@ public: HookManager& hooks() const { return scope().hooks(); } KeymapManager& keymaps() const { return scope().keymaps(); } AliasRegistry& aliases() const { return scope().aliases(); } - FaceRegistry& faces() const { return scope().faces(); } + FaceRegistry& faces(bool allow_local = true) const { return scope(allow_local).faces(); } void print_status(DisplayLine status) const; diff --git a/src/input_handler.cc b/src/input_handler.cc index e11740c7..99fb684e 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -657,7 +657,8 @@ public: : InputMode(input_handler), m_callback(std::move(callback)), m_completer(std::move(completer)), m_prompt(prompt.str()), m_prompt_face(face), m_empty_text{std::move(emptystr)}, - m_line_editor{context().faces()}, m_flags(flags), + // This prompt may outlive local scopes so ignore local faces. + m_line_editor{context().faces(false)}, m_flags(flags), m_was_interactive{not context().noninteractive()}, m_history{RegisterManager::instance()[history_register]}, m_current_history{-1}, diff --git a/test/regression/0-eval-creates-prompt/cmd b/test/regression/0-eval-creates-prompt/cmd new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/0-eval-creates-prompt/cmd @@ -0,0 +1 @@ + diff --git a/test/regression/0-eval-creates-prompt/in b/test/regression/0-eval-creates-prompt/in new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/0-eval-creates-prompt/in @@ -0,0 +1 @@ + diff --git a/test/regression/0-eval-creates-prompt/script b/test/regression/0-eval-creates-prompt/script new file mode 100644 index 00000000..c9455f5e --- /dev/null +++ b/test/regression/0-eval-creates-prompt/script @@ -0,0 +1,5 @@ +ui_out -ignore 7 +ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ ":eval %{ exec %{:echo -} }" ] }' +ui_out -ignore 5 +ui_in '{ "jsonrpc": "2.0", "method": "keys", "params": [ "markup 123" ] }' +ui_out -until-grep '"method": "draw_status", .* "contents": "123"' >/dev/null