bczsalba / pytermgui

Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
https://ptg.bczsalba.com
MIT License
2.16k stars 53 forks source link

Remove redraw flashing #123

Open Tired-Fox opened 1 year ago

Tired-Fox commented 1 year ago

All instances of redrawing will now call \x1b[H to go to home position and then draw over all characters on the screen. This removed screen flickering for many if not most of terminal emulators. When a full redraw is needed, when the terminal resizes, the redraw is set to full and will fully clear the screen instead of going to home.

bczsalba commented 1 year ago

Hey! Sorry about the delay.

Unfortunately it seems this is gonna be a bit more complicated. When windows are drawn we only draw their current state, and as a result not doing a full clear is causing a whole lot of ghosting to happen.

I remember dealing with this a long time ago; there are ways to get around it. We could, for example keep track of windows that changed sizes and draw a "blank" that fills up their previous space, or we could also make the whole "home clear" an optional feature of the WindowManager, so people who rely on windows getting resized/moved around don't run into this problem.

I'll try to think of things we could do to get around it, but it's probably gonna involve having a new look at the compositor. As I mentioned in the Discord I do have a solution to this, but unfortunately it isn't compatible with practically any of PTG's underbelly.

Thank you!