mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
Stop crashing if last view is closed.
This commit is contained in:
parent
28c167d71d
commit
d559199cec
@ -601,11 +601,18 @@ fn handle_event(&mut self, event: Event, cx: &mut Context) -> EventResult {
|
||||
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…
Reference in New Issue
Block a user