Gracefully handle reloading a file that was deleted
This commit is contained in:
parent
87fcfda508
commit
d6d81607ed
|
@ -173,11 +173,16 @@ void Client::reload_buffer()
|
||||||
{
|
{
|
||||||
auto& buffer = context().buffer();
|
auto& buffer = context().buffer();
|
||||||
kak_assert(buffer.flags() & Buffer::Flags::File);
|
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);
|
kak_assert(buf == &buffer);
|
||||||
context().print_status({ format("'{}' reloaded", buffer.display_name()),
|
context().print_status({ format("'{}' reloaded", buffer.display_name()),
|
||||||
get_face("Information") });
|
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)
|
void Client::on_buffer_reload_key(Key key)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user