aboutsummaryrefslogtreecommitdiff
path: root/helix-view
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-16 03:29:22 +0000
committerBlaž Hrastnik2020-10-16 03:30:46 +0000
commit49cc6c19244462b80beeac96be0ea0cc5bc1febc (patch)
treef3a6b3dffef73fd239468ceae473ec90f3d84260 /helix-view
parent267602328c0c164136244517bbf7176f4c729c67 (diff)
Refactor Editor into Application and Editor/Workspace.
Diffstat (limited to 'helix-view')
-rw-r--r--helix-view/src/editor.rs20
-rw-r--r--helix-view/src/lib.rs2
2 files changed, 22 insertions, 0 deletions
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<View>,
+}
+
+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(())
+ }
+}
diff --git a/helix-view/src/lib.rs b/helix-view/src/lib.rs
index e0a230ca..8ea634af 100644
--- a/helix-view/src/lib.rs
+++ b/helix-view/src/lib.rs
@@ -1,7 +1,9 @@
pub mod commands;
+pub mod editor;
pub mod keymap;
pub mod prompt;
pub mod theme;
pub mod view;
+pub use editor::Editor;
pub use view::View;