[GH-ISSUE #753] Action menu shortcut numbers not working anymore #446

Closed
opened 2026-03-02 23:47:34 +03:00 by kerem · 4 comments
Owner

Originally created by @bartlibert on GitHub (Jun 23, 2025).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/753

Describe the bug
When I open the action menu on a track (a or g a shorcut by default), the "number" shortcuts don't work anymore. This started with 0.20.6, so I guess the "vim like motions" change (which is great by the way!), caused this.

To Reproduce

  • Make sure there is an active track in spotify_player
  • Press a to open the actions for the current track
  • Press 2 for GoToRadio
  • Observe nothing happens

Expected behaviour
After pressing 2, the radio for the current track should be started

Screenshots

Image

Environment

  • OS: Arch Linux
  • Application version: 0.20.6
  • Application features: --no-default-features --features notify,pulseaudio-backend,media-control,daemon,image,sixel,fzf
Originally created by @bartlibert on GitHub (Jun 23, 2025). Original GitHub issue: https://github.com/aome510/spotify-player/issues/753 **Describe the bug** When I open the action menu on a track (`a` or `g a` shorcut by default), the "number" shortcuts don't work anymore. This started with 0.20.6, so I guess the "vim like motions" change (which is great by the way!), caused this. **To Reproduce** - Make sure there is an active track in spotify_player - Press `a` to open the actions for the current track - Press `2` for `GoToRadio` - Observe nothing happens **Expected behaviour** After pressing `2`, the radio for the current track should be started **Screenshots** ![Image](https://github.com/user-attachments/assets/3cf5778a-9f7f-49f6-b438-7f490da8a728) **Environment** - OS: Arch Linux - Application version: 0.20.6 - Application features: --no-default-features --features notify,pulseaudio-backend,media-control,daemon,image,sixel,fzf
kerem 2026-03-02 23:47:34 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@aome510 commented on GitHub (Jun 23, 2025):

Thanks for reporting! @markgandolfo is this something you can help take a look?

<!-- gh-comment-id:2997243984 --> @aome510 commented on GitHub (Jun 23, 2025): Thanks for reporting! @markgandolfo is this something you can help take a look?
Author
Owner

@markgandolfo commented on GitHub (Jun 24, 2025):

I'll have a look tonight

<!-- gh-comment-id:2998991141 --> @markgandolfo commented on GitHub (Jun 24, 2025): I'll have a look tonight
Author
Owner

@markgandolfo commented on GitHub (Jun 24, 2025):

I think we can just disable it for all ui.popup do you see any issue with that?
Also, any thoughts on adding some tests to ./tests/? I'm happy to write a unit test for this.

diff --git a/spotify_player/src/event/mod.rs b/spotify_player/src/event/mod.rs
index 117cc89..41d361f 100644
--- a/spotify_player/src/event/mod.rs
+++ b/spotify_player/src/event/mod.rs
@@ -101,22 +101,25 @@ fn handle_key_event(
     let mut ui = state.ui.lock();

     // Check if the key is a digit and handle count prefix
-    if let Key::None(KeyCode::Char(c)) = key {
-        if c.is_ascii_digit() {
-            let digit = c.to_digit(10).unwrap() as usize;
-            // If we have an existing count prefix, append the digit
-            // Otherwise, start a new count (but ignore leading zeros)
-            ui.count_prefix = match ui.count_prefix {
-                Some(count) => Some(count * 10 + digit),
-                None => {
-                    if digit > 0 {
-                        Some(digit)
-                    } else {
-                        None
+    // Only handle vim motions when not in a popup to avoid interfering with action selection
+    if ui.popup.is_none() {
+        if let Key::None(KeyCode::Char(c)) = key {
+            if c.is_ascii_digit() {
+                let digit = c.to_digit(10).unwrap() as usize;
+                // If we have an existing count prefix, append the digit
+                // Otherwise, start a new count (but ignore leading zeros)
+                ui.count_prefix = match ui.count_prefix {
+                    Some(count) => Some(count * 10 + digit),
+                    None => {
+                        if digit > 0 {
+                            Some(digit)
+                        } else {
+                            None
+                        }
                     }
-                }
-            };
-            return Ok(());
+                };
+                return Ok(());
+            }
         }
     }
<!-- gh-comment-id:2999103993 --> @markgandolfo commented on GitHub (Jun 24, 2025): I think we can just disable it for all `ui.popup` do you see any issue with that? Also, any thoughts on adding some tests to `./tests/`? I'm happy to write a unit test for this. ```diff diff --git a/spotify_player/src/event/mod.rs b/spotify_player/src/event/mod.rs index 117cc89..41d361f 100644 --- a/spotify_player/src/event/mod.rs +++ b/spotify_player/src/event/mod.rs @@ -101,22 +101,25 @@ fn handle_key_event( let mut ui = state.ui.lock(); // Check if the key is a digit and handle count prefix - if let Key::None(KeyCode::Char(c)) = key { - if c.is_ascii_digit() { - let digit = c.to_digit(10).unwrap() as usize; - // If we have an existing count prefix, append the digit - // Otherwise, start a new count (but ignore leading zeros) - ui.count_prefix = match ui.count_prefix { - Some(count) => Some(count * 10 + digit), - None => { - if digit > 0 { - Some(digit) - } else { - None + // Only handle vim motions when not in a popup to avoid interfering with action selection + if ui.popup.is_none() { + if let Key::None(KeyCode::Char(c)) = key { + if c.is_ascii_digit() { + let digit = c.to_digit(10).unwrap() as usize; + // If we have an existing count prefix, append the digit + // Otherwise, start a new count (but ignore leading zeros) + ui.count_prefix = match ui.count_prefix { + Some(count) => Some(count * 10 + digit), + None => { + if digit > 0 { + Some(digit) + } else { + None + } } - } - }; - return Ok(()); + }; + return Ok(()); + } } } ```
Author
Owner

@markgandolfo commented on GitHub (Jun 24, 2025):

pull request - https://github.com/aome510/spotify-player/pull/754

<!-- gh-comment-id:2999888515 --> @markgandolfo commented on GitHub (Jun 24, 2025): pull request - https://github.com/aome510/spotify-player/pull/754
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-player#446
No description provided.