diff options
author | Blaž Hrastnik | 2020-10-19 08:18:03 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2020-12-03 04:07:55 +0000 |
commit | 64b5b23315f12125a2c5b2f810fe5ac285bdfa79 (patch) | |
tree | f8caf756f461727e454c94b8e8c2abfeffa943e6 /helix-view/src/editor.rs | |
parent | b2b3083a623ec3dc5e2d1ea9c6ba35970efe19a3 (diff) |
Move theme from view to editor, support multiple views in editor.
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(()) } |