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
{{ message }}
Repository navigation
Formatting fails when value-to-print is very large #607
Start bpython (happens in both bpython version 0.15 on top of Python 3.5.1+ /usr/bin/python3 and bpython version 0.15 on top of Python 2.7.11+ /usr/bin/python)
Do something that has at least two screenfuls of output when printed. Example: ["Hello"] * 1000
Expected result: boring stuff. Just the printed "value" of a list that contains a thousand "hello"s.
Actual result: The value, and then some formatting related characters that got garbled:
Note the trailing U+001B which smells like formatting gone wrong.
I'm not sure whether this is a bug in xfce4-terminal 0.6.3, bpython, bpython-curtsies, curtsies, or maybe something else entirely. However, bpython is the only program exhibiting this behavior, so I reported it here.
I'm guessing something's happening to the math in Curtsies such that the "Cursor Home" command that moves the cursor <ESC>[{ROW};{COLUMN}H came out with a negative row here. I checked and Blessings passes through negative numbers to its Terminal.move command, so this is possible.
So probably one of the numbers in cursor_pos[0] - offscreen_scrolls + self.top_usable_row is bad, but I don't know which. I don't have a Linux machine around at the moment to check.
It turns out this is happening in my terminal too, but iTerm2 swallows the invalid sequence! It's likely a Curtsies issue, these sequence may not be doing anything important, I'll look into it more.
I noticed in a gif I uploaded for another reason that the cursor disappears sometimes, and I think this may be related based on the Curtsies source: the sequence to make the cursor visible is written just after this sequence that is sometimes negative.
I suspect this is the problem but haven't nicely reproduced it. @BenWiederhake if it's not much trouble would you try pip install git+https://github.com/thomasballinger/curtsies.git@fix-bpython-607 to see if it fixes the problem?
(For fun I pip uninstalled this version of curtsies again, as a sanity check of sorts, and indeed: with the old system version, it still shows the faulty behavior, so your fix definitely works.)
Great, I've merged that and will do a Curtsies release before long, so at least fresh installations of Curtsies will have it fixed. I'll leave this open until I've done that Curtsies release.
Activity
thomasballinger commentedon Apr 12, 2016
I bet this is some nonstandard terminal formatting that curtsies is doing. I can't reproduce at the moment, but will try soon with xfce.
thomasballinger commentedon Jun 6, 2016
/me still hasn't tried with xfce
I'm guessing something's happening to the math in Curtsies such that the "Cursor Home" command that moves the cursor
<ESC>[{ROW};{COLUMN}Hcame out with a negative row here. I checked and Blessings passes through negative numbers to its Terminal.move command, so this is possible.So probably one of the numbers in
cursor_pos[0] - offscreen_scrolls + self.top_usable_rowis bad, but I don't know which. I don't have a Linux machine around at the moment to check.thomasballinger commentedon Jun 7, 2016
It turns out this is happening in my terminal too, but iTerm2 swallows the invalid sequence! It's likely a Curtsies issue, these sequence may not be doing anything important, I'll look into it more.
thomasballinger commentedon Jun 13, 2016
I noticed in a gif I uploaded for another reason that the cursor disappears sometimes, and I think this may be related based on the Curtsies source: the sequence to make the cursor visible is written just after this sequence that is sometimes negative.

thomasballinger commentedon Aug 6, 2016
I suspect this is the problem but haven't nicely reproduced it. @BenWiederhake if it's not much trouble would you try
pip install git+https://github.com/thomasballinger/curtsies.git@fix-bpython-607to see if it fixes the problem?BenWiederhake commentedon Aug 6, 2016
Appears to work, thanks :D
(For fun I
pip uninstalled this version of curtsies again, as a sanity check of sorts, and indeed: with the old system version, it still shows the faulty behavior, so your fix definitely works.)thomasballinger commentedon Aug 7, 2016
Great, I've merged that and will do a Curtsies release before long, so at least fresh installations of Curtsies will have it fixed. I'll leave this open until I've done that Curtsies release.
sebastinas commentedon Oct 10, 2016
A new version of curtsies has been released in the meantime.