From 49cc6c19244462b80beeac96be0ea0cc5bc1febc Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 16 Oct 2020 12:29:22 +0900 Subject: Refactor Editor into Application and Editor/Workspace. --- helix-view/src/editor.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 helix-view/src/editor.rs (limited to 'helix-view/src/editor.rs') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs new file mode 100644 index 00000000..444e4bf7 --- /dev/null +++ b/helix-view/src/editor.rs @@ -0,0 +1,20 @@ +use crate::View; + +use std::path::PathBuf; + +use anyhow::Error; + +pub struct Editor { + pub view: Option, +} + +impl Editor { + pub fn new() -> Self { + Self { view: None } + } + + pub fn open(&mut self, path: PathBuf, size: (u16, u16)) -> Result<(), Error> { + self.view = Some(View::open(path, size)?); + Ok(()) + } +} -- cgit v1.2.3-70-g09d2