aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-07 05:19:58 +0000
committerBlaž Hrastnik2021-05-07 05:19:58 +0000
commit7c915dc0651f2cd69bc40adca027729c3b12f4e3 (patch)
tree0885df668617196cb1413f02faa8419f17a24b22 /helix-view/src
parentf8844c68116cbbb1f24c49a5a7da95da7963616e (diff)
Add the :new command, don't crash if saving without filename.
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 83208f78..e9f027f3 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -7,12 +7,16 @@ use slotmap::SlotMap;
use anyhow::Error;
+pub use helix_core::diagnostic::Severity;
+
pub struct Editor {
pub tree: Tree,
pub documents: SlotMap<DocumentId, Document>,
pub count: Option<usize>,
pub theme: Theme,
pub language_servers: helix_lsp::Registry,
+
+ pub status_msg: Option<(String, Severity)>,
}
#[derive(Copy, Clone)]
@@ -43,9 +47,18 @@ impl Editor {
count: None,
theme,
language_servers,
+ status_msg: None,
}
}
+ pub fn set_status(&mut self, status: String) {
+ self.status_msg = Some((status, Severity::Info));
+ }
+
+ pub fn set_error(&mut self, error: String) {
+ self.status_msg = Some((error, Severity::Error));
+ }
+
fn _refresh(&mut self) {
for (view, _) in self.tree.views_mut() {
let doc = &self.documents[view.doc];