diff options
author | Nathan Vegdahl | 2021-07-17 17:49:03 +0000 |
---|---|---|
committer | Nathan Vegdahl | 2021-07-17 17:49:03 +0000 |
commit | a77274e8bb33ff08f5411ec4df168b576c0c8fa5 (patch) | |
tree | 1a1c3735e1f9ea46e87f7fe60b1f81fdb2e5df5b /helix-view/src/editor.rs | |
parent | b4c59b444cc4963f95a95fe10f166e58ef857288 (diff) | |
parent | 6cba62b49917fde7c5876a1cce9d3883c6bef6c9 (diff) |
Merge branch 'master' into great_line_ending_and_cursor_range_cleanup
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); |