aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/view.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-19 08:18:03 +0000
committerBlaž Hrastnik2020-12-03 04:07:55 +0000
commit64b5b23315f12125a2c5b2f810fe5ac285bdfa79 (patch)
treef8caf756f461727e454c94b8e8c2abfeffa943e6 /helix-view/src/view.rs
parentb2b3083a623ec3dc5e2d1ea9c6ba35970efe19a3 (diff)
Move theme from view to editor, support multiple views in editor.
Diffstat (limited to 'helix-view/src/view.rs')
-rw-r--r--helix-view/src/view.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/helix-view/src/view.rs b/helix-view/src/view.rs
index 2b68dbc3..d2a7d556 100644
--- a/helix-view/src/view.rs
+++ b/helix-view/src/view.rs
@@ -1,8 +1,7 @@
use anyhow::Error;
-use std::{borrow::Cow, path::PathBuf};
+use std::borrow::Cow;
-use crate::theme::Theme;
use helix_core::{
graphemes::{grapheme_width, RopeGraphemes},
indent::TAB_WIDTH,
@@ -12,24 +11,23 @@ use tui::layout::Rect;
pub const PADDING: usize = 5;
+// TODO: view should be View { doc: Document(state, history,..) }
+// since we can have multiple views into the same file
pub struct View {
pub state: State,
- pub history: History,
pub first_line: usize,
pub size: (u16, u16),
- pub theme: Theme, // TODO: share one instance
+
+ // TODO: Doc<> fields
+ pub history: History,
}
impl View {
- pub fn open(path: PathBuf, size: (u16, u16)) -> Result<Self, Error> {
- let theme = Theme::default();
- let state = State::load(path, theme.scopes())?;
-
+ pub fn new(state: State, size: (u16, u16)) -> Result<Self, Error> {
let view = Self {
state,
first_line: 0,
size,
- theme,
history: History::default(),
};