aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-04-01 01:39:46 +0000
committerBlaž Hrastnik2021-04-01 02:01:26 +0000
commit0dbd5b61ef4b75ba141b0b52636f3ba7c61c70cb (patch)
treed831ce257c3333d338ac41c235afac295bd90bf0 /helix-view/src
parentceea5eacd814c5bbd8c6789610c87a882e3d72cf (diff)
Simplify code by providin cx.current() = (view, doc).
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index b2408eb9..a4ce2aca 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -172,6 +172,12 @@ impl Editor {
self.tree.is_empty()
}
+ pub fn current(&mut self) -> (&mut View, &mut Document) {
+ let view = self.tree.get_mut(self.tree.focus);
+ let doc = &mut self.documents[view.doc];
+ (view, doc)
+ }
+
pub fn view(&self) -> &View {
self.tree.get(self.tree.focus)
}