diff options
author | Christian Duerr <contact@christianduerr.com> | 2020-01-31 00:00:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 00:00:23 +0000 |
commit | 2ef5e47b8e8591d9df5e3198daad9308b7851343 (patch) | |
tree | 5c1d4b9c6f7e88380c396e638666e3b58e25f2da /alacritty_terminal/src/ansi.rs | |
parent | 7f4dce2ee04859fb0b48f15cf808b60065778703 (diff) | |
download | alacritty-2ef5e47b8e8591d9df5e3198daad9308b7851343.tar.gz alacritty-2ef5e47b8e8591d9df5e3198daad9308b7851343.zip |
Mirror OSC query terminator
Fixes #3091.
Diffstat (limited to 'alacritty_terminal/src/ansi.rs')
-rw-r--r-- | alacritty_terminal/src/ansi.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs index 94331992..bac7e0c7 100644 --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -317,7 +317,7 @@ pub trait Handler { fn set_color(&mut self, _: usize, _: Rgb) {} /// Write a foreground/background color escape sequence with the current color - fn dynamic_color_sequence<W: io::Write>(&mut self, _: &mut W, _: u8, _: usize) {} + fn dynamic_color_sequence<W: io::Write>(&mut self, _: &mut W, _: u8, _: usize, _: &str) {} /// Reset an indexed color to original value fn reset_color(&mut self, _: usize) {} @@ -326,7 +326,7 @@ pub trait Handler { fn set_clipboard(&mut self, _: u8, _: &[u8]) {} /// Write clipboard data to child. - fn write_clipboard<W: io::Write>(&mut self, _: u8, _: &mut W) {} + fn write_clipboard<W: io::Write>(&mut self, _: u8, _: &mut W, _: &str) {} /// Run the decaln routine. fn decaln(&mut self) {} @@ -743,8 +743,9 @@ where // TODO replace OSC parsing with parser combinators #[inline] - fn osc_dispatch(&mut self, params: &[&[u8]]) { + fn osc_dispatch(&mut self, params: &[&[u8]], bell_terminated: bool) { let writer = &mut self.writer; + let terminator = if bell_terminated { "\x07" } else { "\x1b\\" }; fn unhandled(params: &[&[u8]]) { let mut buf = String::new(); @@ -814,7 +815,12 @@ where if let Some(color) = xparse_color(param) { self.handler.set_color(index, color); } else if param == b"?" { - self.handler.dynamic_color_sequence(writer, dynamic_code, index); + self.handler.dynamic_color_sequence( + writer, + dynamic_code, + index, + terminator, + ); } else { unhandled(params); } @@ -852,7 +858,7 @@ where let clipboard = params[1].get(0).unwrap_or(&b'c'); match params[2] { - b"?" => self.handler.write_clipboard(*clipboard, writer), + b"?" => self.handler.write_clipboard(*clipboard, writer, terminator), base64 => self.handler.set_clipboard(*clipboard, base64), } }, |