Handle errors while reloading buffer gracefully

Fixes #1831
This commit is contained in:
Maxime Coste 2018-02-05 20:26:44 +11:00
parent f592768d3a
commit 4a96926c4b

View File

@ -274,10 +274,19 @@ void Client::force_redraw()
void Client::reload_buffer()
{
Buffer& buffer = context().buffer();
try
{
reload_file_buffer(buffer);
context().print_status({ format("'{}' reloaded", buffer.display_name()),
get_face("Information") });
}
catch (runtime_error& error)
{
context().print_status({ format("error while reloading buffer: '{}'", error.what()),
get_face("Error") });
buffer.set_fs_timestamp(get_fs_timestamp(buffer.name()));
}
}
void Client::on_buffer_reload_key(Key key)
{