PAmix icon indicating copy to clipboard operation
PAmix copied to clipboard

Fix flickering of the UI

Open xaizek opened this issue 4 years ago • 2 comments

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.

xaizek avatar Nov 04 '21 13:11 xaizek

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

patroclos avatar Nov 05 '21 23:11 patroclos

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.

xaizek avatar Nov 06 '21 00:11 xaizek