Skip to content
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

Fix flickering of the UI #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

xaizek
Copy link

@xaizek xaizek commented Nov 4, 2021

Draw everything into curses buffer and then draw it all at once on the screen via doupdate().

clear() is the problematic one, because it's actually a combination of erase() and refresh() and there is no need to refresh the screen between clearing and redrawing.

Draw everything into curses buffer and then draw it all at once on the
screen via `doupdate()`.

`clear()` is the problematic one, because it's actually a combination of
`erase() and refresh()` and there is no need to refresh screen between
clearing and redrawing.
@patroclos
Copy link
Owner

Ok I looked into this, clear does not call refresh internally.
It does however cause a complete repaint the next time refresh is called, instead of
just computing and applying the difference.

This behavior is actually needed occasionally, for example when resizing the terminal
in your fork there is a good chance to get some scrambled output.

I'm not sure if this is the only case where a complete refresh is needed

@xaizek
Copy link
Author

xaizek commented Nov 6, 2021

Ok I looked into this, clear does not call refresh internally.
It does however cause a complete repaint the next time refresh is called, instead of
just computing and applying the difference.

You're right, clearing is delayed.

This behavior is actually needed occasionally, for example when resizing the terminal
in your fork there is a good chance to get some scrambled output.

I don't think that erase() and doupdate() will leave something from previous state, but can add redrawwin() to tell curses to not assume any particular terminal state and get clear-like behaviour without that irritating flicker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants