Gracefully handle reloading a file that was deleted

This commit is contained in:
Maxime Coste 2015-06-05 13:11:04 +01:00
parent 87fcfda508
commit d6d81607ed

View File

@ -173,11 +173,16 @@ void Client::reload_buffer()
{
auto& buffer = context().buffer();
kak_assert(buffer.flags() & Buffer::Flags::File);
Buffer* buf = create_buffer_from_file(buffer.name());
if (Buffer* buf = create_buffer_from_file(buffer.name()))
{
kak_assert(buf == &buffer);
context().print_status({ format("'{}' reloaded", buffer.display_name()),
get_face("Information") });
}
else
context().print_status({ format("could not reload '{}'", buffer.display_name()),
get_face("Error") });
}
void Client::on_buffer_reload_key(Key key)
{