@@ -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