diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-11-21 20:07:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 20:07:24 +0100 |
commit | 63e7531c48f1c8fbe916e3ac5475cf36201f52b8 (patch) | |
tree | 534e56cf9cf2924cec94a32bef1b6bcf92760209 /zellij-tile | |
parent | 5ad0429adc3bbb33b2578d3e699f2e61d6d0b940 (diff) |
performance(rendering): improve rendering performance (#1960)
* refactor(plugins): plugins now need to explicitly ask to be rendered
* performance(render): remove various needless renders
* performance(render): cache boundaries
* performance(render): adjust tests and cache cursor location/shape
* style(comment): remove outdated
* style(fmt): rustfmt
Diffstat (limited to 'zellij-tile')
-rw-r--r-- | zellij-tile/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/zellij-tile/src/lib.rs b/zellij-tile/src/lib.rs index 00dc60a96..800b6d684 100644 --- a/zellij-tile/src/lib.rs +++ b/zellij-tile/src/lib.rs @@ -6,7 +6,9 @@ use zellij_utils::data::Event; #[allow(unused_variables)] pub trait ZellijPlugin { fn load(&mut self) {} - fn update(&mut self, event: Event) {} + fn update(&mut self, event: Event) -> bool { + false + } // return true if it should render fn render(&mut self, rows: usize, cols: usize) {} } @@ -41,15 +43,13 @@ macro_rules! register_plugin { } #[no_mangle] - pub fn update() { + pub fn update() -> bool { let object = $crate::shim::object_from_stdin() .context($crate::PLUGIN_MISMATCH) .to_stdout() .unwrap(); - STATE.with(|state| { - state.borrow_mut().update(object); - }); + STATE.with(|state| state.borrow_mut().update(object)) } #[no_mangle] |