Regression test for https://github.com/Textualize/rich/issues/3838 If soft_wrap is True and a style is set, we don't want to style the new lines.
()
| 1113 | |
| 1114 | |
| 1115 | def test_soft_wrap_styled() -> None: |
| 1116 | """Regression test for https://github.com/Textualize/rich/issues/3838 |
| 1117 | |
| 1118 | If soft_wrap is True and a style is set, we don't want to style the new lines. |
| 1119 | """ |
| 1120 | console = Console(color_system="standard", width=80, force_terminal=True) |
| 1121 | with console.capture() as capture: |
| 1122 | console.print("soft wrap is on", style="blue on white", soft_wrap=True) |
| 1123 | console.print("Next line") |
| 1124 | |
| 1125 | output = capture.get() |
| 1126 | print(repr(output)) |
| 1127 | # Background is reset before \n |
| 1128 | expected = "\x1b[34;47msoft wrap is on\x1b[0m\nNext line\n" |
| 1129 | assert output == expected |