aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-02-04 07:49:55 +0000
committerBlaž Hrastnik2021-02-04 07:49:55 +0000
commit446a7e574359aa2da778d22ca9c5e3f98704fac7 (patch)
tree9376997eed954618ed9069b628f08b491819a4a0 /helix-view
parent448c1abba04e11f77e53629dc06fe47619a741d4 (diff)
Don't render selections/cursors on views not in focus.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs9
1 files changed, 3 insertions, 6 deletions
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<Document>,
- 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)
}
}