aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-03 08:46:14 +0000
committerBlaž Hrastnik2021-05-03 08:46:14 +0000
commitd559199cecb105e07d9812603889a469d415e8b8 (patch)
treeb66c48cd126a24e567946b71c83478cb84a18290 /helix-term/src
parent28c167d71d910d113d5217349830a42fa52e9a9d (diff)
Stop crashing if last view is closed.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/ui/editor.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 13ac88fd..041096d6 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -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);