Open ale-dd opened 2 months ago
I suppose that part of the issue may also be that the renderer height is unknown. Guessing this since the bottom toolbar for the progress bar is not showing up and I also get a:
WARNING: your terminal doesn't support cursor position requests (CPR).
Oh wow, suprisingly all these issues all vanish if I do not use uvloop
...
I've built full-screen apps where of course I would have no need for patch_stdout(). More recently I started enriching "regular" scripts with occasional progress bars and prompts. For what I need a full screen app seemed kind of overkill, and I liked the idea for the experience to be easily able to gracefully degrade when the output is being piped into log files.
I wish the documentation around
patch_stdout()
would go a lot more in depth and perhaps enumerate all widgets that would and would not "bypass" the patched standard output, together with good and bad patterns. From certain examples, it seems like its context is only wrapping the use of certain widgets while other threads print to the terminal. Yet, I've run into situations where if I don't wrap a print in a patch_stdout() context, the print ruins the terminal output for a progress bar widget from a different coroutine than the one the print is coming from.So, I've been lazily sprinkling
with patch_stdout()
all over the place, without thinking too much. I'd use it generously and a bit too naively, without trying to understand things too well and perhaps counting too much on the fact that its implementation looked like it should be re-entrant. Of course I ended up with a little bit of a nightmare at hand.Maybe I should just be less stubborn and build yet another full-screen app instead.
In any case, here's some of the nightmarish stuff I have been able to cause thus far:
1.
2.
3.
4.
5.
I understand that providing a minimal code snippet to reproduce these issues would be better, and perhaps I'll find the time to do so in the future. Meanwhile, is there any chance from the little info I could provide you'd have any hint as to how I should be doing instead and what I shouldn't be doing?
Thank you!