From: Gerrit Renker Date: Sat, 12 Mar 2011 19:32:56 +0000 (+0100) Subject: Configuration screen: memorize last active line X-Git-Url: http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p=wavemon.git;a=commitdiff_plain;h=094538edab8a590ffb14af2101725563d2453104 Configuration screen: memorize last active line This fixes a bug in the configuration menu - the last active line was not reset properly when switching back from another window. Changed it in such a way that it now memorizes the last active position, which is handy when trying out different values for a given parameter. --- diff --git a/conf_scr.c b/conf_scr.c index b9aba23..a338771 100644 --- a/conf_scr.c +++ b/conf_scr.c @@ -165,9 +165,11 @@ void scr_conf_init(void) w_conf = newwin_title(0, WAV_HEIGHT, "Preferences", false); w_confpad = newpad(num_items + 1, CONF_SCREEN_WIDTH); - while ((item = ll_get(conf_items, active_item)) && item->type == t_sep) - active_item++; - first_item = active_item; + if (first_item) /* already initialized */ + return; + while ((item = ll_get(conf_items, first_item)) && item->type == t_sep) + first_item++; + active_item = first_item; } int scr_conf_loop(WINDOW *w_menu)