From 49d64fbeecbdde2293ca0e7c7346941791685c3e Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Fri, 1 Apr 2022 01:10:12 +0200 Subject: Fix OSC 4 color response format The commit 60ef17e introduced support for the color query response escape for OSC 4, however it did omit the `4;` prefix and started the OSC with just the color index. This patch fixes this bug and correctly responds to queries with full OSC 4 format, including prefix plus color index. Fixes #5981. --- alacritty_terminal/src/term/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'alacritty_terminal/src/term') diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index fa7d2b66..14dd306e 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1630,10 +1630,10 @@ impl Handler for Term { self.colors[index] = Some(color); } - /// Write a foreground/background color escape sequence with the current color. + /// Respond to a color query escape sequence. #[inline] - fn dynamic_color_sequence(&mut self, code: u8, index: usize, terminator: &str) { - trace!("Requested write of escape sequence for color code {}: color[{}]", code, index); + fn dynamic_color_sequence(&mut self, prefix: String, index: usize, terminator: &str) { + trace!("Requested write of escape sequence for color code {}: color[{}]", prefix, index); let terminator = terminator.to_owned(); self.event_proxy.send_event(Event::ColorRequest( @@ -1641,7 +1641,7 @@ impl Handler for Term { Arc::new(move |color| { format!( "\x1b]{};rgb:{1:02x}{1:02x}/{2:02x}{2:02x}/{3:02x}{3:02x}{4}", - code, color.r, color.g, color.b, terminator + prefix, color.r, color.g, color.b, terminator ) }), )); -- cgit v1.2.3-54-g00ecf