From e2136a65e15d7fc55ee1845c89cea32fa69a6546 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Sun, 11 Oct 2026 03:11:53 -0400 Subject: [PATCH] Track row index history --- src/c/jellyPod.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/c/jellyPod.c b/src/c/jellyPod.c index 92e950c..09370b4 100644 --- a/src/c/jellyPod.c +++ b/src/c/jellyPod.c @@ -16,7 +16,7 @@ typedef struct { bool using_search; char subscope_search[255]; // TODO tighten and only store first character char subscope_artist[255]; - // const char *subscope_album; // future use + uint16_t scroll_row[NAV_SCOPE_ALBUM_TRACKS + 1]; // last selected row per scope } History; // constants @@ -117,8 +117,11 @@ static void inbox_received_handler(DictionaryIterator *iter, void *context) { append_to_subscope_history(); } + // when moving deeper start at the top, otherwise restore the row the user left off on + uint16_t scroll_row = moving_deeper ? 0 : s_nav_history.scroll_row[s_current_menu_scope]; + s_nav_history.scroll_row[s_current_menu_scope] = scroll_row; menu_layer_reload_data(s_menu_layer); - menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false); + menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, scroll_row), MenuRowAlignTop, false); return; } } @@ -164,7 +167,7 @@ static void to_pkjs_move_back() { // return to main menu s_current_menu_scope = NAV_SCOPE_MAIN; menu_layer_reload_data(s_menu_layer); - menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, 0), MenuRowAlignTop, false); + menu_layer_set_selected_index(s_menu_layer, MenuIndex(0, s_nav_history.scroll_row[NAV_SCOPE_MAIN]), MenuRowAlignTop, false); } else { // otherwise determine last subscope and go to previous scope switch (s_current_menu_scope) { @@ -212,6 +215,7 @@ static void menu_draw_row(GContext *ctx, const Layer *cell_layer, MenuIndex *cel } static void menu_select_click(struct MenuLayer *menu_layer, MenuIndex *clicked_index, void *context) { + s_nav_history.scroll_row[s_current_menu_scope] = clicked_index->row; switch (s_current_menu_scope) { case NAV_SCOPE_MAIN: switch (clicked_index->row) {