From 092effba0473318538bc2dbf5fa6b45417eaf32b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 21 Jul 2021 07:56:36 -0700 Subject: [PATCH] fix background color cloning 4e99edf6f5fc75dbdcf396a08f382e0368be2f32 split the color into thin/fat components, but overlooked copying the optional fat part of the color. That in turn broke sequences like: * Set background color * Erase to end of line This commit teaches the sgr attribute cloning function to look at the optional fat component. refs: #962 --- termwiz/src/cell.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/termwiz/src/cell.rs b/termwiz/src/cell.rs index 246bcf296..560bb8cd2 100644 --- a/termwiz/src/cell.rs +++ b/termwiz/src/cell.rs @@ -397,6 +397,16 @@ impl CellAttributes { background: self.background, fat: None, }; + if let Some(fat) = self.fat.as_ref() { + if fat.background != ColorAttribute::Default + || fat.foreground != ColorAttribute::Default + { + res.allocate_fat_attributes(); + let mut new_fat = res.fat.as_mut().unwrap(); + new_fat.foreground = fat.foreground; + new_fat.background = fat.background; + } + } // Reset the semantic type; clone_sgr_only is used primarily // to create a "blank" cell when clearing and we want that to // be deterministically tagged as Output so that we have an