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

Scroll lag on key hold #32

Closed
mbpowers opened this issue Nov 24, 2021 · 5 comments · Fixed by #37
Closed

Scroll lag on key hold #32

mbpowers opened this issue Nov 24, 2021 · 5 comments · Fixed by #37
Labels
bug Something isn't working help wanted Extra attention is needed next release research-needed

Comments

@mbpowers
Copy link

When you hold j/k/up/down there is lag and will continue scrolling for a bit after the key is released. The lag doesn't become noticeable until I scroll more than about 10 items, but since I have a fairly large library cluttered with unplayed games from humble bundle this is frequent. If the scrolling lag is not an easy fix, a good work around would be to be able to filter the list to downloaded only.

Love the ascii art and vim binds, very cool program.

@dmadisetti
Copy link
Owner

Thanks 🎉 !

Hm, I haven't really noticed this. Is it for rapid pressing or when you hold down? There do definitely need to be more filters (DLCs, demos, other than games; see #11)
You can search, but that doesn't address the issue.
I have 2 theories:

  1. When you hit a new game, theres a blocking call to get an image if one does not exist (only the first time though). That could be the slow down, but should be better once you have scrolled the library. Changing the image to ANSI is also blocking.
  2. Since there's no debouncing in place, the event is triggered multiple times causing issues.

It might be both lol.

To address 1. we'd need background downloads (which actually couples with the proposed async implementation of #29), and/or ANSI caching. I think this is going to be a change to the widget itself. The original author is unresponsive, so we're working off this fork: https://github.com/AnotherGroupChat/tui-image/tree/rgba

To address 2 we need some debouncing logic, which I think is straightforward? Something I've never had to implement, but would probably require a change to the event handling:

impl Events {

anyway, I don't expect anyone to fix this, just suggesting solutions to the ether. When/if I do start working on this program again, I think this, #29, and #8 will be noticable speed improvements.

@dmadisetti dmadisetti added enhancement New feature or request help wanted Extra attention is needed research-needed bug Something isn't working next release and removed enhancement New feature or request labels Nov 24, 2021
@mbpowers
Copy link
Author

mbpowers commented Nov 24, 2021

It's only when you hold it down.

Never touched rust but as it's so popular I figured I should dip my toes in, and this seems like a good project to join in on the fun. I might try and take a stab at some of these but don't wanna get your hopes up in case I fail or don't have time haha.

Also not getting the auto-downloaded icons ¯\(ツ)

@mbpowers
Copy link
Author

Figured out why I'm not getting the images its cause I pulled the steam-tui instead of steam-tui-git from AUR. false alarm!

@dmadisetti
Copy link
Owner

Yeah, I think rust is fun. If it's only on hold down, then # 2 (debouncing) is likely the issue.

So there are 2 event types, one is a timed event (we want the main loop to run every so often to communicate with the client thread), the other is an event loop (we want to respond to a user push). So debouncing means that we should not stack events, but wait an interval before the one next event queues. I think? There's probably better explanations online (all my quick Googling points me at JavaScript examples though). Good luck! Let me know if you run into any problems, and checkout Some basic rust documentation first: https://learnxinyminutes.com/docs/rust/

Rust is weird at first, but pretty powerful once you understand its quirks

@dmadisetti
Copy link
Owner

Yeah I see it. It overshoots and i slow to take off. Managing the event queue is the right way to do this.

@dmadisetti dmadisetti linked a pull request Jul 3, 2022 that will close this issue
Merged
dmadisetti added a commit that referenced this issue Jul 3, 2022
Issues: #8, #11, #17, #28, #32, #34
Prs: #35, #29

* Fix dev env and update deps

* I liked your changes, merging them in (#36)

Laar3 changes

* Lars cleanup

* cleaned up interface

* Allow for game filtering

* Add time delay as psuedo-debounce for #32

* Favourites + Install highlights + another debounce

* Added proton lookup (#17, #29)

* Add mutex to trace game status

* Updated tui version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed next release research-needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants