Avoid flickering#210
Conversation
StdRedirectMixin makes the bar erase itself before writing the new update. This works fine and is invisible most of the time. Most of the time -- If the refreshes are very fast, flickering becomes visible This PR first checks if there is something buffered to be written in stdout/stderr, and doesn't erase the current line otherwise
|
It took me a while to look at this, but I'm wondering if there is a need for this because there is already a detection for that: https://github.com/WoLpH/python-progressbar/blob/develop/progressbar/utils.py#L154-L160 I should note that this is also a bit terminal dependent, many terminals won't really show the flickering at all. Which one are you using? |
|
The existing check copies the internal buffer to stdout/stderr if there is something to be copied, which makes sense. The issue is that the output line always gets overwritten by blanks and then rewritten, which is what this PR fixes. I'm using Konsole, and it works without issues most of the time -- It was only when I accidentally started calling update in a close loop that the flickering was visible. |
|
Ah, now I see what you mean. There might actually be an easier method to take care of this because I don't think the flushing is needed in all cases anymore. But I'm a bit hesitant to change it, the handling of output is very sensitive to breakage, even the Anyhow, the That code checks for newlines, so it should indicate the need for writing the new line (or not) |
|
This project was really fun to work on, and you have been very receptive to my PRs, thank you very much! This is all I had, I'm probably leaving you in peace now :) |
|
Thank you for all of the help :) |
StdRedirectMixin makes the bar erase itself before writing the new update.
This works fine and is invisible most of the time.
But only most of the time -- If the refreshes are very fast, flickering becomes visible
This PR first checks if there is something buffered to be written in stdout/stderr, and doesn't erase the current line otherwise