~exitb/retrofit

b921eacb9c1a406ea3412f1dc16e2b46b51828fd — exitb 1 year, 10 months ago 97b7315
Ignore PabloDraw sequences when not in truecolor
1 files changed, 19 insertions(+), 16 deletions(-)

M src/adapter.rs
M src/adapter.rs => src/adapter.rs +19 -16
@@ 112,6 112,7 @@ impl Style {
        mut self,
        parameters: &[u16],
        introducer: &ControlSequenceIntroducer,
        truecolor: bool,
    ) -> Result<Style> {
        match introducer {
            ControlSequenceIntroducer::SelectGraphicRendition => {


@@ 120,24 121,26 @@ impl Style {
                }
            }
            ControlSequenceIntroducer::PabloDraw24BitColor => {
                impl From<std::num::TryFromIntError> for Error {
                    fn from(err: std::num::TryFromIntError) -> Self {
                        Error::ParameterToColor(err)
                if truecolor {
                    impl From<std::num::TryFromIntError> for Error {
                        fn from(err: std::num::TryFromIntError) -> Self {
                            Error::ParameterToColor(err)
                        }
                    }
                }

                match *parameters {
                    [0, red, green, blue] => {
                        self.background =
                            Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
                    }
                    [1, red, green, blue] => {
                        self.foreground =
                            Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
                    match *parameters {
                        [0, red, green, blue] => {
                            self.background =
                                Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
                        }
                        [1, red, green, blue] => {
                            self.foreground =
                                Color::True(parse_color(red)?, parse_color(green)?, parse_color(blue)?)
                        }
                        _ => Err(Error::UnknownPabloDraw24BitColorParameterFormat(
                            parameters.to_vec(),
                        ))?,
                    }
                    _ => Err(Error::UnknownPabloDraw24BitColorParameterFormat(
                        parameters.to_vec(),
                    ))?,
                }
            }
            _ => Err(Error::UnsupportedCsiForStyleParsing(introducer.clone()))?,


@@ 462,7 465,7 @@ where
                    }
                    ControlSequenceIntroducer::SelectGraphicRendition
                    | ControlSequenceIntroducer::PabloDraw24BitColor => {
                        let new_brush = self.brush.clone().parse(&parameters, &introducer)?;
                        let new_brush = self.brush.clone().parse(&parameters, &introducer, self.truecolor)?;

                        if self.brush != new_brush {
                            let difference_params = new_brush.render_difference(