Skip to content

IndexError when printing certain characters in data #194

@waynew

Description

@waynew

I'm not sure exactly which characters, but:

bpython version 0.26 on top of Python 3.14.3 /home/wayne/.local/share/uv/tools/bpython/bin/python
>>> x = b'\x1b[34mDEBUG \x1b[0m| 18:02:06 10568 [SerialConsole] \x1b[34mGot client heartbeat\r\n\x1b[0
m\x1b[34mDEBUG \x1b[0m| 18:02:06 10568 [SerialConsole] \x1b[34mFromRadio=STATE_SEND_QUEUE_STATUS, numb
ytes=6\r\n\x1b[0m'
>>> print(x.decode())


Traceback (most recent call last):
  File "<input>", line 1, in <module>
    print(x.decode())
  File "/home/wayne/.local/share/uv/tools/bpython/lib/python3.12/site-packages/bpython/curtsiesfronten
d/coderunner.py", line 218, in write
    self.on_write(s, *args, **kwargs)
  File "/home/wayne/.local/share/uv/tools/bpython/lib/python3.12/site-packages/bpython/curtsiesfronten
d/repl.py", line 1378, in send_to_stdouterr
    paint.display_linize(
  File "/home/wayne/.local/share/uv/tools/bpython/lib/python3.12/site-packages/bpython/curtsiesfronten
d/replpainter.py", line 25, in display_linize
    display_lines = list(msg.width_aware_splitlines(columns))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wayne/.local/share/uv/tools/bpython/lib/python3.12/site-packages/curtsies/formatstring.p
y", line 666, in _width_aware_splitlines
    splitter = self.chunks[0].splitter()
               ~~~~~~~~~~~^^^
IndexError: list index out of range

It probably should look something like this:

screenshot of the above text, rendered in a colorized output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions