Stop crashing if last view is closed.

imgbot
Blaž Hrastnik 3 years ago
parent 28c167d71d
commit d559199cec

@ -601,11 +601,18 @@ impl Component for EditorView {
mode => self.command_mode(mode, &mut cxt, key),
}
}
self.on_next_key = cxt.on_next_key_callback.take();
self.status_msg = cxt.status_msg.take();
// appease borrowck
let callback = cxt.callback.take();
// if the command consumed the last view, skip the render.
// on the next loop cycle the Application will then terminate.
if cx.editor.should_close() {
return EventResult::Ignored;
}
let (view, doc) = cx.editor.current();
view.ensure_cursor_in_view(doc);

Loading…
Cancel
Save