X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=ui%2Fncurses%2Fnc-config.c;h=6c252602a1a58ce16c493de5c624b378719f8615;hp=ca8c44c0e6bfb74a3208f251e83cdd135fb3eb01;hb=df46fcfe4867fd16729bb10dfb82dcd43595c6c2;hpb=6afcd04684c27823afc778f712006e02b7470faf diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c index ca8c44c..6c25260 100644 --- a/ui/ncurses/nc-config.c +++ b/ui/ncurses/nc-config.c @@ -471,17 +471,22 @@ static void config_screen_setup_widgets(struct config_screen *screen, config_screen_network_change, screen); screen->widgets.iface_l = widget_new_label(set, 0, 0, "Device:"); - screen->widgets.iface_f = widget_new_select(set, 0, 0, 20); + screen->widgets.iface_f = widget_new_select(set, 0, 0, 50); for (i = 0; i < sysinfo->n_interfaces; i++) { struct interface_info *info = sysinfo->interfaces[i]; + char str[50], mac[20]; bool is_default; is_default = ifcfg && !memcmp(ifcfg->hwaddr, info->hwaddr, sizeof(ifcfg->hwaddr)); + mac_str(info->hwaddr, info->hwaddr_size, mac, sizeof(mac)); + snprintf(str, sizeof(str), "%s [%s, %s]", info->name, mac, + info->link ? "link up" : "link down"); + widget_select_add_option(screen->widgets.iface_f, - i, info->name, is_default); + i, str, is_default); } gw = ip = mask = NULL; @@ -535,17 +540,16 @@ static void config_screen_setup_widgets(struct config_screen *screen, static void config_screen_widget_focus(struct nc_widget *widget, void *arg) { struct config_screen *screen = arg; - int w_y, w_height, s_max; + int w_y, s_max; - w_y = widget_y(widget); - w_height = widget_height(widget); - s_max = getmaxy(screen->scr.sub_ncw); + w_y = widget_y(widget) + widget_focus_y(widget); + s_max = getmaxy(screen->scr.sub_ncw) - 1; if (w_y < screen->scroll_y) screen->scroll_y = w_y; - else if (w_y + w_height + screen->scroll_y > s_max - 1) - screen->scroll_y = 1 + w_y + w_height - s_max; + else if (w_y + screen->scroll_y + 1 > s_max) + screen->scroll_y = 1 + w_y - s_max; else return;