File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8-
98## Unreleased
109
1110### Fixed
@@ -16,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1615- Thread used in progress.track will exit if an exception occurs in a generator https://github.com/Textualize/rich/pull/3402
1716- Progress track thread is now a daemon thread https://github.com/Textualize/rich/pull/3402
1817- Fixed cached hash preservation upon clearing meta and links https://github.com/Textualize/rich/issues/2942
18+ - Fixed overriding the ` background_color ` of ` Syntax ` not including padding https://github.com/Textualize/rich/issues/3295
1919
2020### Changed
2121
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3131
3232## [ 13.7.1] - 2024-02-28
3333
34+
3435### Fixed
3536
3637- Updated the widths of some characters https://github.com/Textualize/rich/pull/3289
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ The following people have contributed to the development of Rich:
2020- [ Aryaz Eghbali] ( https://github.com/AryazE )
2121- [ Oleksis Fraga] ( https://github.com/oleksis )
2222- [ Andy Gimblett] ( https://github.com/gimbo )
23+ - [ Tom Gooding] ( https://github.com/TomJGooding )
2324- [ Michał Górny] ( https://github.com/mgorny )
2425- [ Nok Lam Chan] ( https://github.com/noklam )
2526- [ Leron Gray] ( https://github.com/daddycocoaman )
Original file line number Diff line number Diff line change @@ -619,9 +619,7 @@ def __rich_console__(
619619 ) -> RenderResult :
620620 segments = Segments (self ._get_syntax (console , options ))
621621 if self .padding :
622- yield Padding (
623- segments , style = self ._theme .get_background_style (), pad = self .padding
624- )
622+ yield Padding (segments , style = self ._get_base_style (), pad = self .padding )
625623 else :
626624 yield segments
627625
Original file line number Diff line number Diff line change @@ -406,6 +406,23 @@ def test_syntax_measure():
406406 assert code .__rich_measure__ (console , console .options ) == Measurement (3 , 24 )
407407
408408
409+ def test_background_color_override_includes_padding ():
410+ """Regression test for https://github.com/Textualize/rich/issues/3295"""
411+
412+ syntax = Syntax (
413+ "x = 1" ,
414+ lexer = "python" ,
415+ padding = (1 , 3 ),
416+ background_color = "red" ,
417+ )
418+ result = render (syntax )
419+ print (repr (result ))
420+ assert (
421+ result
422+ == "\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 "
423+ )
424+
425+
409426if __name__ == "__main__" :
410427 syntax = Panel .fit (
411428 Syntax (
You can’t perform that action at this time.
0 commit comments