aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/ansi.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2022-04-01 01:10:12 +0200
committerGitHub <noreply@github.com>2022-03-31 23:10:12 +0000
commit49d64fbeecbdde2293ca0e7c7346941791685c3e (patch)
treeb2bf743b9cda53399185cd45b5dc1d1fb3e851eb /alacritty_terminal/src/ansi.rs
parentb16fe1259cebcd6adb4bc92f7025beb696412b89 (diff)
downloadalacritty-49d64fbeecbdde2293ca0e7c7346941791685c3e.tar.gz
alacritty-49d64fbeecbdde2293ca0e7c7346941791685c3e.zip
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.
Diffstat (limited to 'alacritty_terminal/src/ansi.rs')
-rw-r--r--alacritty_terminal/src/ansi.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index c5ddb3bf..f4e8fde1 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -430,8 +430,8 @@ pub trait Handler {
/// Set an indexed color value.
fn set_color(&mut self, _: usize, _: Rgb) {}
- /// Write a foreground/background color escape sequence with the current color.
- fn dynamic_color_sequence(&mut self, _: u8, _: usize, _: &str) {}
+ /// Respond to a color query escape sequence.
+ fn dynamic_color_sequence(&mut self, _: String, _: usize, _: &str) {}
/// Reset an indexed color to original value.
fn reset_color(&mut self, _: usize) {}
@@ -997,7 +997,8 @@ where
if let Some(c) = xparse_color(chunk[1]) {
self.handler.set_color(index as usize, c);
} else if chunk[1] == b"?" {
- self.handler.dynamic_color_sequence(index, index as usize, terminator);
+ let prefix = format!("4;{}", index);
+ self.handler.dynamic_color_sequence(prefix, index as usize, terminator);
} else {
unhandled(params);
}
@@ -1023,7 +1024,7 @@ where
self.handler.set_color(index, color);
} else if param == b"?" {
self.handler.dynamic_color_sequence(
- dynamic_code,
+ dynamic_code.to_string(),
index,
terminator,
);