File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -402,6 +402,23 @@ def test_syntax_measure():
402402 assert code .__rich_measure__ (console , console .options ) == Measurement (3 , 24 )
403403
404404
405+ def test_background_color_override_includes_padding ():
406+ """Regression test for https://github.com/Textualize/rich/issues/3295"""
407+
408+ syntax = Syntax (
409+ "x = 1" ,
410+ lexer = "python" ,
411+ padding = (1 , 3 ),
412+ background_color = "red" ,
413+ )
414+ result = render (syntax )
415+ print (repr (result ))
416+ assert (
417+ result
418+ == "\x1b [41m \x1b [0m\n \x1b [41m \x1b [0m\x1b [38;2;248;248;242;41mx\x1b [0m\x1b [38;2;248;248;242;41m \x1b [0m\x1b [38;2;255;70;137;41m=\x1b [0m\x1b [38;2;248;248;242;41m \x1b [0m\x1b [38;2;174;129;255;41m1\x1b [0m\x1b [41m \x1b [0m\x1b [41m \x1b [0m\n \x1b [41m \x1b [0m\n "
419+ )
420+
421+
405422if __name__ == "__main__" :
406423 syntax = Panel .fit (
407424 Syntax (
You can’t perform that action at this time.
0 commit comments