diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-03-02 21:49:42 +0300 |
---|---|---|
committer | Christian Duerr <contact@christianduerr.com> | 2023-03-06 08:19:58 +0100 |
commit | 841558201ecfc961d879520101d8470afda2ee92 (patch) | |
tree | 44c060f88853556a88075170bab96e1423d5719d | |
parent | 038d508c34ba69fc8d98dbf830a001c1bfbdd93e (diff) | |
download | alacritty-841558201ecfc961d879520101d8470afda2ee92.tar.gz alacritty-841558201ecfc961d879520101d8470afda2ee92.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)] |