-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] The whole screen is refreshed on each key press #81
Comments
Welcome to the project! This is something I've working on a fix for on-and-off for a couple of months now. You can see it mentioned in the pytermgui/pytermgui/window_manager/compositor.py Lines 230 to 239 in b2bb571
I have a decently performant This issue is actually much more widespread than it may appear; the sandbox file There is also a case to be made to only "render" each widget when it requests it, not on every frame. As mentioned above, this should be a secondary concern at the moment, since Python speed is very rarely going to be the bottleneck. Of course, it will likely still be improved in the future. Might have gotten a bit too rant-y there, so: TL;DR: A really cool fix is in works and on the way. |
Thank you for the update and I'm happy to hear that you're working on the problem. I'm not sure I've understood well enough your first plan with the canvas, but I believe that the 2nd part about just rendering each widget only when it's modified will improve the performance substantially. Also, try it on slow SSH connections, e.g. across the ocean back and forth, and see how a simple app compares to typical ncurses app. |
Seems like this flicker bug is prevalent when moving the mouse in the Windows Terminal as well. With xterm in WSL the flicker is non-existent. |
While we have made some progress towards helping with this, unfortunately the ideal solution (at least from what I found, implemented in shade40's slate) requires PTG's core to be uprooted and reimplemented, which isn't likely to happen. I'll keep this issue open, but I'll remove the in-progress label. |
@bczsalba Thank you for the update, I appreciate it. |
Describe the bug
The whole screen is refreshed on each key press and that is super-ugly on some terminals like the Windows Terminal, plus it will cause a serious lag on slow network connections.
To Reproduce
Steps to reproduce the behavior:
Note: this problem does not occur on smarter terminals like Gnome Terminal simply because they redraw the screen in a async way. But, the problem will we visible across network connections, because the whole screen data must be re-sent on each key press.
Expected behavior
When writing text, only the single chars must be written to the screen, without redrawing everything. That is harder to achieve, I know, but it will make a big difference.
System information
I installed the latest version from pip,
ptg.__version__
is 6.4.0.Possible solution
I haven't studied this project enough to propose a reasonable solution, but more or less it's Flutter's problem:
UI = Func(data)
does not work well in the real world without a lot of hacks under the hood. For example, Flutter compares the new UI tree with the old one of the fly and redraws only the diff.The text was updated successfully, but these errors were encountered: