survey icon indicating copy to clipboard operation
survey copied to clipboard

Terminal consistently flickers when scrolling through paginated list of options

Open aq17 opened this issue 2 years ago • 4 comments

What operating system and terminal are you using? MacOS+default terminal, also saw same issue on Windows+PowerShell

An example that showcases the bug. (short clip to fit 10mb limit, but continues as you scroll down the list and paginate) https://user-images.githubusercontent.com/54565933/179568187-b4d8e098-a23b-4484-b988-ca143dda607a.mov

What did you expect to see? No flickering when scrolling through paginated list

What did you see instead? Flickering when scrolling through paginated list

aq17 avatar Jul 18 '22 17:07 aq17

I have this issue also, using Alacrity terminal

jquick avatar Aug 02 '22 19:08 jquick

Same behaviour on Linux (Wayland) in "foot" terminal.

ekini avatar Aug 02 '22 21:08 ekini

I also experience this and wanted to find ways to mitigate. This is the redrawing logic: https://github.com/AlecAivazis/survey/blob/e47352f914346a910cc7e1ca9f65a7ac0674449a/renderer.go#L135-L145

Perhaps there is a way to redraw the last N lines in a terminal in a way that doesn't cause flickering. Ideas welcome!

mislav avatar Aug 03 '22 14:08 mislav

Perhaps there is a way to redraw the last N lines in a terminal in a way that doesn't cause flickering. Ideas welcome!

There are application synchronized updates: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/2

TL;DR application emits one escape at the beginning of a "frame" (update) and another one when done.

Note that there are two variants; the DCS initially suggested in the MR, which was the first one implemented by terminals. Later, it was generally agreed that a "private mode" was better, and the 2026 private mode was added.

Another option is writing the erase commands into a buffer, and doing a single actual terminal write.

dnkl avatar Aug 03 '22 17:08 dnkl