From 446a7e574359aa2da778d22ca9c5e3f98704fac7 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Thu, 4 Feb 2021 16:49:55 +0900 Subject: Don't render selections/cursors on views not in focus. --- helix-view/src/editor.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'helix-view/src') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index eb745066..be400935 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -10,7 +10,6 @@ use anyhow::Error; pub struct Editor { pub tree: Tree, // pub documents: Vec, - pub focus: Key, pub should_close: bool, pub theme: Theme, // TODO: share one instance pub language_servers: helix_lsp::Registry, @@ -23,7 +22,6 @@ impl Editor { Self { tree: Tree::new(area), - focus: Key::default(), should_close: false, theme, language_servers, @@ -52,16 +50,15 @@ impl Editor { } let view = View::new(doc)?; - let pos = self.tree.insert(view); - self.focus = pos; + self.tree.insert(view); Ok(()) } pub fn view(&self) -> &View { - self.tree.get(self.focus) + self.tree.get(self.tree.focus) } pub fn view_mut(&mut self) -> &mut View { - self.tree.get_mut(self.focus) + self.tree.get_mut(self.tree.focus) } } -- cgit v1.2.3-70-g09d2