Regression test for https://github.com/Textualize/rich/issues/3841 Soft wrap should not strip trailing whitespace.
()
| 1095 | |
| 1096 | |
| 1097 | def test_soft_wrap() -> None: |
| 1098 | """Regression test for https://github.com/Textualize/rich/issues/3841 |
| 1099 | |
| 1100 | Soft wrap should not strip trailing whitespace. |
| 1101 | |
| 1102 | """ |
| 1103 | console = Console(color_system="standard", width=80, force_terminal=True) |
| 1104 | text = Text(" Hello World ", style="white on blue") |
| 1105 | |
| 1106 | with console.capture() as capture: |
| 1107 | console.print(text, soft_wrap=True) |
| 1108 | |
| 1109 | output = capture.get() |
| 1110 | print(repr(output)) |
| 1111 | expected = "\x1b[37;44m Hello World \x1b[0m\n" |
| 1112 | assert output == expected |
| 1113 | |
| 1114 | |
| 1115 | def test_soft_wrap_styled() -> None: |