From 09f481e753d49af92afac7b7b98efbc627646fa7 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 12 Feb 2018 07:40:20 -0800 Subject: [PATCH] avoid ambiguous true color csi SGR sequence --- term/src/csi.rs | 10 ++++++++++ term/src/terminalstate.rs | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/term/src/csi.rs b/term/src/csi.rs index 423466a42..9d1c05342 100644 --- a/term/src/csi.rs +++ b/term/src/csi.rs @@ -191,6 +191,10 @@ impl<'a> CSIParser<'a> { self.advance_by(1, params); Some(CSIAction::SetPenNoLink(CellAttributes::default())) } + // This variant with a colorspace becomes ambiguous when + // embedded like this: [0, 1, 38, 2, 204, 204, 204, 48, 2, 85, 85, 204] + // so we're turning it off for now. + /* &[38, 2, _colorspace, red, green, blue, _..] => { // ISO-8613-6 true color foreground self.advance_by(6, params); @@ -202,6 +206,7 @@ impl<'a> CSIParser<'a> { }), )) } + */ &[38, 2, red, green, blue, _..] => { // KDE konsole compatibility for truecolor foreground self.advance_by(5, params); @@ -213,6 +218,10 @@ impl<'a> CSIParser<'a> { }), )) } + // This variant with a colorspace becomes ambiguous when + // embedded like this: [0, 1, 38, 2, 204, 204, 204, 48, 2, 85, 85, 204] + // so we're turning it off for now. + /* &[48, 2, _colorspace, red, green, blue, _..] => { // ISO-8613-6 true color background self.advance_by(6, params); @@ -224,6 +233,7 @@ impl<'a> CSIParser<'a> { }), )) } + */ &[48, 2, red, green, blue, _..] => { // KDE konsole compatibility for truecolor background self.advance_by(5, params); diff --git a/term/src/terminalstate.rs b/term/src/terminalstate.rs index 3de3712f9..64cd9445a 100644 --- a/term/src/terminalstate.rs +++ b/term/src/terminalstate.rs @@ -1125,6 +1125,15 @@ impl vte::Perform for TerminalState { } } fn csi_dispatch(&mut self, params: &[i64], intermediates: &[u8], ignore: bool, byte: char) { + /* + println!( + "CSI params={:?}, intermediates={:?} b={:02x} {}", + params, + intermediates, + byte as u8, + byte , + ); + */ for act in CSIParser::new(params, intermediates, ignore, byte) { self.perform_csi(act); }