aboutsummaryrefslogtreecommitdiff
path: root/nncmpp.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-05-30 14:41:44 +0200
committerPřemysl Eric Janouch <p@janouch.name>2023-05-30 14:41:44 +0200
commit14dba91dd1b13f1839687c3cd37c245768d36b95 (patch)
treec3036e288e45f8c45dd4691f95c8de584d4d3239 /nncmpp.c
parentdcb2829e9b9792065918ba9903cd03051d36f89f (diff)
downloadnncmpp-14dba91dd1b13f1839687c3cd37c245768d36b95.tar.gz
nncmpp-14dba91dd1b13f1839687c3cd37c245768d36b95.tar.xz
nncmpp-14dba91dd1b13f1839687c3cd37c245768d36b95.zip
Add a go-to-playing action and binding
Diffstat (limited to 'nncmpp.c')
-rw-r--r--nncmpp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nncmpp.c b/nncmpp.c
index 266588d..e05af0b 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -3021,6 +3021,7 @@ g_normal_defaults[] =
{ "C-PageUp", ACTION_TAB_PREVIOUS },
{ "C-PageDown", ACTION_TAB_NEXT },
+ { "o", ACTION_GOTO_PLAYING },
{ "Home", ACTION_GOTO_TOP },
{ "End", ACTION_GOTO_BOTTOM },
{ "M-<", ACTION_GOTO_TOP },
@@ -3343,6 +3344,13 @@ current_tab_on_action (enum action action)
switch (action)
{
const char *id;
+ case ACTION_GOTO_PLAYING:
+ if (g.song < 0 || (size_t) g.song >= tab->item_count)
+ return false;
+
+ tab->item_selected = g.song;
+ app_ensure_selection_visible ();
+ return true;
case ACTION_MOVE_UP:
return current_tab_move_selection (-1);
case ACTION_MOVE_DOWN: