src: Prevent :prompt -on-change from crashing the editor

Fixes #1217
This commit is contained in:
Frank LENORMAND 2018-12-01 08:41:29 +03:00
parent 16908bf091
commit f0e07cc73c

View File

@ -1908,7 +1908,17 @@ const CommandDesc prompt_cmd = {
case PromptEvent::Change: cmd = on_change; break; case PromptEvent::Change: cmd = on_change; break;
case PromptEvent::Abort: cmd = on_abort; 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);
}
}); });
} }
}; };