diff options
Diffstat (limited to 'helix-view/src/editor.rs')
-rw-r--r-- | helix-view/src/editor.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 4f01cce4..cd9d0a92 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -39,6 +39,7 @@ pub struct Editor { #[derive(Debug, Copy, Clone)] pub enum Action { + Load, Replace, HorizontalSplit, VerticalSplit, @@ -97,16 +98,14 @@ impl Editor { self._refresh(); } - pub fn set_theme_from_name(&mut self, theme: &str) { - let theme = match self.theme_loader.load(theme.as_ref()) { - Ok(theme) => theme, - Err(e) => { - log::warn!("failed setting theme `{}` - {}", theme, e); - return; - } - }; - + pub fn set_theme_from_name(&mut self, theme: &str) -> anyhow::Result<()> { + use anyhow::Context; + let theme = self + .theme_loader + .load(theme.as_ref()) + .with_context(|| format!("failed setting theme `{}`", theme))?; self.set_theme(theme); + Ok(()) } fn _refresh(&mut self) { @@ -153,6 +152,9 @@ impl Editor { return; } + Action::Load => { + return; + } Action::HorizontalSplit => { let view = View::new(id); let view_id = self.tree.split(view, Layout::Horizontal); |