aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src/editor.rs
blob: c292caed3f1e93838afc3ebb2f4a65a14b94d179 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::View;

use std::path::PathBuf;

use anyhow::Error;

pub struct Editor {
    pub view: Option<View>,
    pub should_close: bool,
}

impl Editor {
    pub fn new() -> Self {
        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(())
    }
}