aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.37k stars 146 forks source link

add jump to track command #501

Closed aNNiMON closed 1 month ago

aNNiMON commented 1 month ago

Resolves #484

I decided to refresh my ancient Rust knowledge and resolve my own feature request by myself 😄

It turns out that the simple jump to track action is better suited for this feature than the alternative of pressing # and entering a track number. The latter requires a track position to be persistent in the model, while currently track numbers are calculated during rendering.

aome510 commented 1 month ago

Thanks for updating @aNNiMON. As I think about this more, I think it's better to define the feature as a Command instead of a Action. The reason is that this feature is specific to the currently playing track while a track action should be generic and self-explanatory. For example, it has no use when you call that action in an already selected track in the context.

Then the command can be named JumpToCurrentTrackInContext or something with a detailed description so that user can know how to use it.

aNNiMON commented 1 month ago

@aome510 done. I'm using g c key map here (c — current track). Let me know if this key map should be changed to something else (e.g. g 0).

aome510 commented 1 month ago

@aome510 done. I'm using g c key map here (c — current track). Let me know if this key map should be changed to something else (e.g. g 0).

g c makes sense. I pushed a change myself to make the handling logic more clear. It also now supports all the context pages instead of just the Tracks page. The nested callbacks are quite hard to follow