diff options
author | Christian Duerr <contact@christianduerr.com> | 2024-09-22 16:34:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-22 14:34:14 +0000 |
commit | c74b5fa857a133298f0207c499c47cb95b27c78c (patch) | |
tree | c915fdab4cb4dd9d700c4250a078c8341f735a25 /alacritty/src/event.rs | |
parent | 8dfd2e56ad7aaeaf09aaf9f680420cc5988155b0 (diff) | |
download | r-alacritty-c74b5fa857a133298f0207c499c47cb95b27c78c.tar.gz r-alacritty-c74b5fa857a133298f0207c499c47cb95b27c78c.tar.bz2 r-alacritty-c74b5fa857a133298f0207c499c47cb95b27c78c.zip |
Ignore cursor color request with default colors
Currently when the cursor colors are requested for the default cursor
color, Alacritty always responds with #000000. Since this is most likely
incorrect, this response is misleading.
Realistically there's very little reason why any application would need
to know the color of the (often dynamically changing) default cursor. So
instead of always reporting an incorrect black value, this patch just
stops reporting values unless the cursor color was explicitly changed.
Closes #8169.
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r-- | alacritty/src/event.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 72009d88..f10346af 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -34,6 +34,7 @@ use alacritty_terminal::index::{Boundary, Column, Direction, Line, Point, Side}; use alacritty_terminal::selection::{Selection, SelectionType}; use alacritty_terminal::term::search::{Match, RegexSearch}; use alacritty_terminal::term::{self, ClipboardType, Term, TermMode}; +use alacritty_terminal::vte::ansi::NamedColor; #[cfg(unix)] use crate::cli::{IpcConfig, ParsedOptions}; @@ -1737,9 +1738,12 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> { } }, TerminalEvent::ColorRequest(index, format) => { - let color = self.ctx.terminal().colors()[index] - .map(Rgb) - .unwrap_or(self.ctx.display.colors[index]); + let color = match self.ctx.terminal().colors()[index] { + Some(color) => Rgb(color), + // Ignore cursor color requests unless it was changed. + None if index == NamedColor::Cursor as usize => return, + None => self.ctx.display.colors[index], + }; self.ctx.write_to_pty(format(color.0).into_bytes()); }, TerminalEvent::TextAreaSizeRequest(format) => { |