From 0dbd5b61ef4b75ba141b0b52636f3ba7c61c70cb Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Thu, 1 Apr 2021 10:39:46 +0900 Subject: Simplify code by providin cx.current() = (view, doc). --- helix-view/src/editor.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'helix-view/src') 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) } -- cgit v1.2.3-70-g09d2