on master help sign in
Stop crashing if last view is closed.
commitd559199cecb105e07d9812603889a469d415e8b8 authorBlaž Hrastnik <blaz@mxxn.io> dateMon 3 May 2021, 17:46 (5 years ago) parent28c167d
1 file changed+7
helix-term/src/ui/editor.rs+7
helix-term/src/ui/editor.rs+7
@@ -601,11 +601,18 @@ impl Component for EditorView {
601601 mode => self.command_mode(mode, &mut cxt, key),
602602 }
603603 }
604+
604605 self.on_next_key = cxt.on_next_key_callback.take();
605606 self.status_msg = cxt.status_msg.take();
606607 // appease borrowck
607608 let callback = cxt.callback.take();
608609
610+ // if the command consumed the last view, skip the render.
611+ // on the next loop cycle the Application will then terminate.
612+ if cx.editor.should_close() {
613+ return EventResult::Ignored;
614+ }
615+
609616 let (view, doc) = cx.editor.current();
610617 view.ensure_cursor_in_view(doc);
611618