X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=menu%2Fm_post.c;h=1dbd6b807bde8a673da7a2581e5f9f161a9db08c;hb=64eb5fae1961774e65e46953fa536d12c12f6d76;hp=b4b1bc14eb77fc32cb3c72425dd3b116b146333c;hpb=b661daf1160a873609d70843999cd46eff25d1f0;p=ncurses.git diff --git a/menu/m_post.c b/menu/m_post.c index b4b1bc14..1dbd6b80 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -38,7 +38,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.35 2021/03/27 23:46:29 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.36 2021/05/08 20:20:01 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -215,45 +215,48 @@ _nc_Draw_Menu(const MENU *menu) lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : item; - do + if (item != NULL) { - ITEM *lasthor; - - wmove(menu->win, y, 0); - - hitem = item; - lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem; - do { - _nc_Post_Item(menu, hitem); + ITEM *lasthor; - wattron(menu->win, (int)menu->back); - if (((hitem = hitem->right) != lasthor) && hitem) + wmove(menu->win, y, 0); + + hitem = item; + lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem; + + do { - int i, j, cy, cx; - chtype ch = ' '; + _nc_Post_Item(menu, hitem); - getyx(menu->win, cy, cx); - for (j = 0; j < menu->spc_rows; j++) + wattron(menu->win, (int)menu->back); + if (((hitem = hitem->right) != lasthor) && hitem) { - wmove(menu->win, cy + j, cx); - for (i = 0; i < menu->spc_cols; i++) + int i, j, cy, cx; + chtype ch = ' '; + + getyx(menu->win, cy, cx); + for (j = 0; j < menu->spc_rows; j++) { - waddch(menu->win, ch); + wmove(menu->win, cy + j, cx); + for (i = 0; i < menu->spc_cols; i++) + { + waddch(menu->win, ch); + } } + wmove(menu->win, cy, cx + menu->spc_cols); } - wmove(menu->win, cy, cx + menu->spc_cols); } - } - while (hitem && (hitem != lasthor)); - wattroff(menu->win, (int)menu->back); + while (hitem && (hitem != lasthor)); + wattroff(menu->win, (int)menu->back); - item = item->down; - y += menu->spc_rows; + item = item->down; + y += menu->spc_rows; + } + while (item && (item != lastvert)); } - while (item && (item != lastvert)); } /*---------------------------------------------------------------------------