From 7877647cf0812380623b0087fbd7bea0ee9fae20 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 19 Feb 2021 17:46:43 +0900 Subject: Allow closing individual views. --- helix-term/src/application.rs | 5 ++--- helix-term/src/commands.rs | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'helix-term/src') diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 90391024..c82724a5 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -82,7 +82,7 @@ impl Application { self.render(); loop { - if self.editor.should_close { + if self.editor.should_close() { break; } @@ -116,9 +116,8 @@ impl Application { None => panic!(), }; - if should_redraw { + if should_redraw && !self.editor.should_close() { self.render(); - // calling render twice here fixes it for some reason } } diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 8aff8035..e65144f4 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -558,7 +558,10 @@ pub fn command_mode(cx: &mut Context) { let parts = input.split_ascii_whitespace().collect::>(); match *parts.as_slice() { - ["q"] => editor.should_close = true, + ["q"] => { + editor.tree.remove(editor.view().id); + // editor.should_close = true, + } ["o", path] => { editor.open(path.into(), executor); } -- cgit v1.2.3-70-g09d2