summaryrefslogtreecommitdiffstats
path: root/default-plugins/status-bar/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-11-21 20:07:24 +0100
committerGitHub <noreply@github.com>2022-11-21 20:07:24 +0100
commit63e7531c48f1c8fbe916e3ac5475cf36201f52b8 (patch)
tree534e56cf9cf2924cec94a32bef1b6bcf92760209 /default-plugins/status-bar/src
parent5ad0429adc3bbb33b2578d3e699f2e61d6d0b940 (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 'default-plugins/status-bar/src')
-rw-r--r--default-plugins/status-bar/src/main.rs28
1 files changed, 26 insertions, 2 deletions
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs
index 25e31d2f5..97f2bd2c6 100644
--- a/default-plugins/status-bar/src/main.rs
+++ b/default-plugins/status-bar/src/main.rs
@@ -182,26 +182,50 @@ impl ZellijPlugin for State {
]);
}
- fn update(&mut self, event: Event) {
+ fn update(&mut self, event: Event) -> bool {
+ let mut should_render = false;
match event {
Event::ModeUpdate(mode_info) => {
+ if self.mode_info != mode_info {
+ should_render = true;
+ }
self.mode_info = mode_info;
},
Event::TabUpdate(tabs) => {
+ if self.tabs != tabs {
+ should_render = true;
+ }
self.tabs = tabs;
},
Event::CopyToClipboard(copy_destination) => {
+ match self.text_copy_destination {
+ Some(text_copy_destination) => {
+ if text_copy_destination != copy_destination {
+ should_render = true;
+ }
+ },
+ None => {
+ should_render = true;
+ },
+ }
self.text_copy_destination = Some(copy_destination);
},
Event::SystemClipboardFailure => {
+ should_render = true;
self.display_system_clipboard_failure = true;
},
Event::InputReceived => {
+ if self.text_copy_destination.is_some()
+ || self.display_system_clipboard_failure == true
+ {
+ should_render = true;
+ }
self.text_copy_destination = None;
self.display_system_clipboard_failure = false;
},
_ => {},
- }
+ };
+ should_render
}
fn render(&mut self, rows: usize, cols: usize) {