[PR #216] [MERGED] Disallow CTRL+d scroll past playlist end #675

Closed
opened 2026-02-28 14:50:26 +03:00 by kerem · 0 comments
Owner

📋 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: masterHead: disallow-scroll-past-playlist-end


📝 Commits (1)

  • 31db389 Fix 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.

## 📋 Pull Request Information **Original PR:** https://github.com/Rigellute/spotify-tui/pull/216 **Author:** [@Monkeyanator](https://github.com/Monkeyanator) **Created:** 1/18/2020 **Status:** ✅ Merged **Merged:** 1/26/2020 **Merged by:** [@Rigellute](https://github.com/Rigellute) **Base:** `master` ← **Head:** `disallow-scroll-past-playlist-end` --- ### 📝 Commits (1) - [`31db389`](https://github.com/Rigellute/spotify-tui/commit/31db3898e75caba0aea95c33374b22520d4915a6) Fix CTRL+d scrolling past end of playlist ### 📊 Changes **2 files changed** (+12 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/app.rs` (+3 -3) 📝 `src/handlers/track_table.rs` (+9 -3) </details> ### 📄 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 :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:50:26 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-tui#675
No description provided.