mirror of
https://github.com/Rigellute/spotify-tui.git
synced 2026-04-26 08:05:57 +03:00
[PR #216] [MERGED] Disallow CTRL+d scroll past playlist end #675
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-tui#675
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Rigellute/spotify-tui/pull/216
Author: @Monkeyanator
Created: 1/18/2020
Status: ✅ Merged
Merged: 1/26/2020
Merged by: @Rigellute
Base:
master← Head:disallow-scroll-past-playlist-end📝 Commits (1)
31db389Fix CTRL+d scrolling past end of playlist📊 Changes
2 files changed (+12 additions, -6 deletions)
View changed files
📝
src/app.rs(+3 -3)📝
src/handlers/track_table.rs(+9 -3)📄 Description
Addresses #192.
Previously, when using CTRL+d to page downwards on a playlist, there was no guard against incrementing the playlist offset past the end of the playlist, resulting in empty track tables. This commit checks if the track table is empty after attempting a CTRL+d scroll and backtracks to
the previous playlist offset.
From what I can tell, the Spotify API doesn't offer a way to get the total size of a playlist, so we can't just check before making a request whether we're about to scroll past the end (which would be ideal). This means that hitting CTRL+d at the end of a playlist results in two API requests (one to notice we got an empty response, and another to reload with the old limit), and consequently this implementation is a bit on the slow side.
I'm quite new to Rust, so please let me know if I've done anything barbarous :)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.