helix/helix-view/src/editor.rs

25 lines
429 B
Rust
Raw Normal View History

use crate::View;
use std::path::PathBuf;
use anyhow::Error;
pub struct Editor {
pub view: Option<View>,
2020-10-16 14:37:12 +09:00
pub should_close: bool,
}
impl Editor {
pub fn new() -> Self {
2020-10-16 14:37:12 +09:00
Self {
view: None,
should_close: false,
}
}
pub fn open(&mut self, path: PathBuf, size: (u16, u16)) -> Result<(), Error> {
self.view = Some(View::open(path, size)?);
Ok(())
}
}