1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-29 10:02:57 +03:00

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,10 +173,15 @@ void Client::reload_buffer()
{
auto& buffer = context().buffer();
kak_assert(buffer.flags() & Buffer::Flags::File);
Buffer* buf = create_buffer_from_file(buffer.name());
kak_assert(buf == &buffer);
context().print_status({ format("'{}' reloaded", buffer.display_name()),
get_face("Information") });
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)