Regression test covering https://github.com/Textualize/rich/issues/3176 and https://github.com/Textualize/textual/issues/3567 - double width characters could result in text going missing when wrapping.
()
| 503 | |
| 504 | |
| 505 | def test_wrap_cjk_mixed(): |
| 506 | """Regression test covering https://github.com/Textualize/rich/issues/3176 and |
| 507 | https://github.com/Textualize/textual/issues/3567 - double width characters could |
| 508 | result in text going missing when wrapping.""" |
| 509 | text = Text("123ありがとうございました") |
| 510 | console = Console(width=20) # let's ensure the width passed to wrap() wins. |
| 511 | |
| 512 | wrapped_lines = text.wrap(console, width=8) |
| 513 | with console.capture() as capture: |
| 514 | console.print(wrapped_lines) |
| 515 | |
| 516 | assert capture.get() == "123あり\nがとうご\nざいまし\nた\n" |
| 517 | |
| 518 | |
| 519 | def test_wrap_long(): |