From b696aae51f48606b8688a635c2ecc8a83ee32b7b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 28 Jan 2018 14:55:28 -0800 Subject: [PATCH] vim truecolor mode uses kde style rgb sgr --- src/term/csi.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/term/csi.rs b/src/term/csi.rs index 71285a052..d50c7b1fa 100644 --- a/src/term/csi.rs +++ b/src/term/csi.rs @@ -206,7 +206,7 @@ impl<'a> CSIParser<'a> { self.advance_by(1, params); Some(CSIAction::SetPen(CellAttributes::default())) } - &[38, 2, _, red, green, blue, _..] => { + &[38, 2, _colorspace, red, green, blue, _..] => { // ISO-8613-6 true color foreground self.advance_by(6, params); Some(CSIAction::SetForegroundColor( @@ -217,7 +217,18 @@ impl<'a> CSIParser<'a> { }), )) } - &[48, 2, _, red, green, blue, _..] => { + &[38, 2, red, green, blue, _..] => { + // KDE konsole compatibility for truecolor foreground + self.advance_by(5, params); + Some(CSIAction::SetForegroundColor( + color::ColorAttribute::Rgb(color::RgbColor { + red: red as u8, + green: green as u8, + blue: blue as u8, + }), + )) + } + &[48, 2, _colorspace, red, green, blue, _..] => { // ISO-8613-6 true color background self.advance_by(6, params); Some(CSIAction::SetBackgroundColor( @@ -228,6 +239,17 @@ impl<'a> CSIParser<'a> { }), )) } + &[48, 2, red, green, blue, _..] => { + // KDE konsole compatibility for truecolor background + self.advance_by(5, params); + Some(CSIAction::SetBackgroundColor( + color::ColorAttribute::Rgb(color::RgbColor { + red: red as u8, + green: green as u8, + blue: blue as u8, + }), + )) + } &[38, 5, idx, _..] => { // 256 color foreground color index self.advance_by(3, params);