summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-01-11 23:58:50 +0300
committerGitHub <noreply@github.com>2022-01-11 23:58:50 +0300
commitfd7573d5d15ab229b233469fd9ab077158ece030 (patch)
tree16692717a818f43319ee1ee69fe4ac89e574a09c
parent01c1cc1278268e1447cf979fe71225f6cd4f27b3 (diff)
downloadalacritty-fd7573d5d15ab229b233469fd9ab077158ece030.tar.gz
alacritty-fd7573d5d15ab229b233469fd9ab077158ece030.zip
Don't blink when cursor is hidden
This prevents unnecessary redraws when the terminal is idle, cursor is hidden and blinking is enabled.
-rw-r--r--alacritty/src/event.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 24762dad..a29a101a 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -919,13 +919,15 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> {
fn update_cursor_blinking(&mut self) {
// Get config cursor style.
let mut cursor_style = self.config.terminal_config.cursor.style;
- if self.terminal.mode().contains(TermMode::VI) {
+ let vi_mode = self.terminal.mode().contains(TermMode::VI);
+ if vi_mode {
cursor_style = self.config.terminal_config.cursor.vi_mode_style.unwrap_or(cursor_style);
- };
+ }
// Check terminal cursor style.
let terminal_blinking = self.terminal.cursor_style().blinking;
- let blinking = cursor_style.blinking_override().unwrap_or(terminal_blinking);
+ let mut blinking = cursor_style.blinking_override().unwrap_or(terminal_blinking);
+ blinking &= vi_mode || self.terminal().mode().contains(TermMode::SHOW_CURSOR);
// Update cursor blinking state.
let timer_id = TimerId::new(Topic::BlinkCursor, self.display.window.id());