diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-06-07 12:43:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 12:43:35 +0200 |
commit | c11d75f9157873fc99fe0d40933de8ec5fbb4f6b (patch) | |
tree | fc55dc7f9132395585613dd9cce94c98c8c76600 /zellij-server/src/ui | |
parent | b8f095330a57c905f23563ca7c2bfae3171abf57 (diff) |
feat(wasm-plugin-system): major overhaul and some goodies (#2510)
* strider resiliency
* worker channel prototype
* finalized ui
* show hide plugin
* fs events to plugins
* tests for events and new screen instructions
* various refactoringz
* report plugin errors instead of crashing zellij
* fix plugin loading with workers
* refactor: move watch filesystem
* some fixes and refactoring
* refactor(panes): combine pane insertion logic
* refactor(screen): launch or focus
* refactor(pty): consolidate default shell fetching
* refactor: various cleanups
* initial refactoring
* more initial refactoring
* refactor(strider): search
* style(fmt): rustfmt
* style(pty): cleanup
* style(clippy): ok clippy
* style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/ui')
-rw-r--r-- | zellij-server/src/ui/loading_indication.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zellij-server/src/ui/loading_indication.rs b/zellij-server/src/ui/loading_indication.rs index 78af2c103..1aa514ec5 100644 --- a/zellij-server/src/ui/loading_indication.rs +++ b/zellij-server/src/ui/loading_indication.rs @@ -45,9 +45,15 @@ impl LoadingIndication { pub fn merge(&mut self, other: LoadingIndication) { let current_animation_offset = self.animation_offset; let current_terminal_emulator_colors = self.terminal_emulator_colors.take(); + let mut current_error = self.error.take(); drop(std::mem::replace(self, other)); self.animation_offset = current_animation_offset; self.terminal_emulator_colors = current_terminal_emulator_colors; + if let Some(current_error) = current_error.take() { + // we do this so that only the first error (usually the root cause) will be shown + // when plugins support scrolling, we might want to do an append here + self.error = Some(current_error); + } } pub fn indicate_loading_plugin_from_memory(&mut self) { self.loading_from_memory = Some(LoadingStatus::InProgress); @@ -104,6 +110,9 @@ impl LoadingIndication { pub fn indicate_loading_error(&mut self, error_text: String) { self.error = Some(error_text); } + pub fn is_error(&self) -> bool { + self.error.is_some() + } fn started_loading(&self) -> bool { self.loading_from_memory.is_some() || self.loading_from_hd_cache.is_some() @@ -257,6 +266,13 @@ impl Display for LoadingIndication { } if let Some(error_text) = &self.error { stringified.push_str(&format!("\n\r{} {error_text}", red.bold().paint("ERROR:"))); + // we add this additional line explicitly to make it easier to realize when something + // is wrong in very small plugins (eg. the tab-bar and status-bar) + stringified.push_str(&format!( + "\n\r{}", + red.bold() + .paint("ERROR IN PLUGIN - check logs for more info") + )); } write!(f, "{}", stringified) } |