You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> from rich import get_console
>>> from rich.text import Text
>>> t = Text().append_tokens([("long text that will be wrapped with a control code \r\n.", "red")])
>>> get_console().print(t, width=40)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/.venv/lib/python3.10/site-packages/rich/console.py", line 1699, in print
extend(render(renderable, render_options))
File "/tmp/.venv/lib/python3.10/site-packages/rich/console.py", line 1331, in render
for render_output in iter_render:
File "/tmp/.venv/lib/python3.10/site-packages/rich/text.py", line 654, in __rich_console__
lines = self.wrap(
File "/tmp/.venv/lib/python3.10/site-packages/rich/text.py", line 1184, in wrap
new_lines = line.divide(offsets)
File "/tmp/.venv/lib/python3.10/site-packages/rich/text.py", line 1113, in divide
line_start, line_end = line_ranges[end_line_no]
IndexError: list index out of range
Describe the bug
A string containing control codepoints passed to
Text.append_tokens
sometimes crashes withIndexError
when printedRelated issues: #2284 and #2963
Minimal code example that demonstrates the issue:
Platform
Click to expand
$ pip freeze | grep rich rich==13.4.2
The text was updated successfully, but these errors were encountered: