From f0e07cc73c41db9afcd33f449f85e2fad097d8d2 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sat, 1 Dec 2018 08:41:29 +0300 Subject: [PATCH] src: Prevent `:prompt -on-change` from crashing the editor Fixes #1217 --- src/commands.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/commands.cc b/src/commands.cc index c9822dda..cf9639fa 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1908,7 +1908,17 @@ const CommandDesc prompt_cmd = { case PromptEvent::Change: cmd = on_change; break; case PromptEvent::Abort: cmd = on_abort; break; } - CommandManager::instance().execute(cmd, context, sc); + try + { + CommandManager::instance().execute(cmd, context, sc); + } + catch (Kakoune::runtime_error& error) + { + context.print_status({ fix_atom_text(error.what().str()), + context.faces()["Error"] }); + context.hooks().run_hook(Hook::RuntimeError, error.what(), + context); + } }); } };