helix icon indicating copy to clipboard operation
helix copied to clipboard

Avoid flashes in dynamic picker

Open Philipp-M opened this issue 1 year ago • 3 comments

It seems that the issue I've discovered in #9647 still persists, now in master.

It's minor, but I would expect that updating (i.e. clearing and populating) the picker item list happens in one frame before flushing the framebuffer to the terminal, to avoid flashes.

An asciinema to show the issue

Philipp-M avatar Jul 15 '24 22:07 Philipp-M

So like, Don't update if there's no change in results?

kumawatdarshan avatar Jul 16 '24 05:07 kumawatdarshan

This is not simple and requires a fundamental refactor of how redraws are handeled with regard to jobs so we delayed it to future work.

pascalkuthe avatar Jul 16 '24 08:07 pascalkuthe

I meant to respond to this in the pickers v2 PR but I must've forgotten. @pascalkuthe and I discussed it and to add context to what Pascal is saying above: the issue is that when any job completes we re-render. The dynamic picker uses a job to get the injector from the picker and set up the async search: https://github.com/helix-editor/helix/blob/22a051408a467ff8b3e43457961d5497903dc7d0/helix-term/src/ui/picker/handlers.rs#L161-L180

So we currently render both when the injector pushes new options (which we do want to cause a render) and when the job that calls picker.matcher.restart(false); completes (which we don't want, causes the flash). https://github.com/the-mikedavis/helix/commit/02853e70ffc05deff06ce729a9c00bb32d91565c is a draft of how it would look to have jobs return whether or not they need a render. It's a fairly verbose change so I'd like to see if there are any other ways around it but that's what we're thinking at the moment

the-mikedavis avatar Jul 16 '24 13:07 the-mikedavis