From: Daniel Date: Sat, 6 Mar 2021 15:54:59 +0000 (-0500) Subject: hl in popup win X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=66d3a8f071cbf459f6799581146d4a34ca6e2c7b;p=taskasaur.git hl in popup win --- diff --git a/menu.c b/menu.c index ab1aa17..4f9ee5e 100644 --- a/menu.c +++ b/menu.c @@ -377,12 +377,11 @@ render_menu(Menu* menu) { /* draw outer menu (prob dont need this every render) */ /* wclear(menu->menu_win); */ - wattron(menu->menu_win, COLOR_PAIR( - (menu->focused == true) ? - TS_MENU_SELECTED: TS_MENU_NONSELECTED - )); + int titlecolor; + titlecolor = COLOR_PAIR((menu->focused == true) ? TS_MENU_SELECTED: TS_MENU_NONSELECTED); + wattron(menu->menu_win, titlecolor); mvwprintw(menu->menu_win, 0, MENU_PAD_LEFT, menu->menu_name); - wattroff(menu->menu_win, COLOR_PAIR(0)); + wattroff(menu->menu_win, titlecolor); /* draw inner menu */ wclear(menu->sub_win); @@ -429,15 +428,14 @@ int render_item(Menu* menu, int item_index, int start_y) { MenuItem* curitem; + int hlcolor; curitem = menu->menu_items[item_index]; /* color selected item */ - wattron(menu->sub_win, COLOR_PAIR( - (item_index == menu->selected_item && menu->focused == true) ? - TS_SELECTED : TS_NONSELECTED - )); + hlcolor = COLOR_PAIR((item_index == menu->selected_item && menu->focused == true) ? TS_SELECTED : TS_NONSELECTED); + wattron(menu->sub_win, hlcolor); mvwprintw(menu->sub_win, start_y, 0, curitem->title); - wattroff(menu->sub_win, COLOR_PAIR(0)); + wattroff(menu->sub_win, hlcolor); /* display number of items */ if (strlen(curitem->description) > 0) { diff --git a/render.c b/render.c index 7db2db3..963e0e5 100644 --- a/render.c +++ b/render.c @@ -315,6 +315,7 @@ make_popup_menu(TodoItem* itemdata) box(popup_win, 0, 0); set_menu_win(new_popup_menu, popup_win); + set_menu_focus(new_popup_menu, 1); return new_popup_menu; } @@ -327,7 +328,8 @@ render_popup_menu(Menu* popup_menu) popup_win = get_menu_win(popup_menu); wclear(popup_win); - /* box(popup_win, 0, 0); */ + box(popup_win, 0, 0); + render_menu(popup_menu); wrefresh(popup_win);