File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,9 @@ impl StyleTreeNode {
366366 } ,
367367 StyleTreeNode :: Code ( child, _) => {
368368 let style = style. bg ( Color :: Indexed ( 236 ) ) ;
369+ let old = printer. set_base_style ( style) ;
369370 child. print ( printer, style) ;
371+ printer. set_base_style ( old) ;
370372 } ,
371373 StyleTreeNode :: Header ( child, level) => {
372374 let style = style. add_modifier ( StyleModifier :: BOLD ) ;
Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ impl<'a> TextPrinter<'a> {
9292 self . width
9393 }
9494
95+ /// Sets the base style and returns the old style
96+ pub fn set_base_style ( & mut self , new : Style ) -> Style {
97+ std:: mem:: replace ( & mut self . base_style , new)
98+ }
99+
95100 /// Create a new printer with a smaller width.
96101 pub fn sub ( & self , indent : usize ) -> Self {
97102 TextPrinter {
You can’t perform that action at this time.
0 commit comments