Skip to content

bpython linewrap is based on number of characters, causing issues with carriage returns #574

Open
@iago-lito

Description

@iago-lito

Dear maintainer,

I am using BPython to run Python scripts, and I found the console output has a different behavior than the regular Python console.. For example this small snippet:

import time
for i in range(100):
    time.sleep(.1)
    print("\r{}".format(i), end="")

outputs in Python:

99                                            |
>>>                                           |

but outputs in BPython:

26                                            |
51                                            |
75                                            |
99                                            |
>>>                                           |
                                              ^ end of the console

These apparently random numbers just depend on my console width. I suspect the BPython cursor to be shifted right on each call to print even though the string starts with a \r. When it reaches the right end of the console, the current line can't be erased anymore and so a new line is started.

How should one tune / slash / fix this?

Thank you so much for BPython anyway :)

(duplicated from there)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions