diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 08fd1f0c..61abd482 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1,4 +1,6 @@ +use crate::theme::Theme; use crate::View; +use helix_core::State; use std::path::PathBuf; @@ -8,20 +10,25 @@ pub struct Editor { pub views: Vec<View>, pub focus: usize, pub should_close: bool, + pub theme: Theme, // TODO: share one instance } impl Editor { pub fn new() -> Self { + let theme = Theme::default(); + Self { views: Vec::new(), focus: 0, should_close: false, + theme, } } pub fn open(&mut self, path: PathBuf, size: (u16, u16)) -> Result<(), Error> { let pos = self.views.len(); - self.views.push(View::open(path, size)?); + let state = State::load(path, self.theme.scopes())?; + self.views.push(View::new(state, size)?); self.focus = pos; Ok(()) } |