diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-03-02 21:49:42 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-02 21:49:42 +0300 |
commit | 66d742d0596203af7ca0e5db47c5b5bc1cc18d91 (patch) | |
tree | c2f984bcb9c42b2ac1f0fdd74fcfbcca21a84026 | |
parent | bf5874805576804ab9ae82949624b1122c3015db (diff) | |
download | alacritty-66d742d0596203af7ca0e5db47c5b5bc1cc18d91.tar.gz alacritty-66d742d0596203af7ca0e5db47c5b5bc1cc18d91.zip |
Fix busy rendering when the same warning persists
When the same warning is thrown on the each rendering iteration, it'll
force alacritty to always render.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
-rw-r--r-- | alacritty/src/event.rs | 6 | ||||
-rw-r--r-- | alacritty/src/message_bar.rs | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 02309188..2ccd42cb 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -1207,7 +1207,8 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { self.ctx.display.cursor_hidden = false; *self.ctx.dirty = true; }, - EventType::Message(message) => { + // Add message only if it's not already queued. + EventType::Message(message) if !self.ctx.message_buffer.is_queued(&message) => { self.ctx.message_buffer.push(message); self.ctx.display.pending_update.dirty = true; }, @@ -1266,7 +1267,8 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { }, #[cfg(unix)] EventType::IpcConfig(_) => (), - EventType::ConfigReload(_) | EventType::CreateWindow(_) => (), + EventType::ConfigReload(_) | EventType::CreateWindow(_) | EventType::Message(_) => { + }, }, WinitEvent::RedrawRequested(_) => *self.ctx.dirty = true, WinitEvent::WindowEvent { event, .. } => { diff --git a/alacritty/src/message_bar.rs b/alacritty/src/message_bar.rs index 988a6a31..267f8322 100644 --- a/alacritty/src/message_bar.rs +++ b/alacritty/src/message_bar.rs @@ -181,6 +181,12 @@ impl MessageBuffer { pub fn push(&mut self, message: Message) { self.messages.push_back(message); } + + /// Check whether the message is already queued in the message bar. + #[inline] + pub fn is_queued(&self, message: &Message) -> bool { + self.messages.contains(message) + } } #[cfg(test)] |