From 7c915dc0651f2cd69bc40adca027729c3b12f4e3 Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 7 May 2021 14:19:58 +0900 Subject: Add the :new command, don't crash if saving without filename. --- helix-view/src/editor.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'helix-view/src') 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, pub count: Option, 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]; -- cgit v1.2.3-70-g09d2