X-Git-Url: http://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=menu%2Fm_post.c;h=cb80230433d5c7efd09b3cd756e01d6b86ca49f1;hb=1a0bb95ebd085cdfd60b68c7b3cccbb31493d6d5;hp=b4b1bc14eb77fc32cb3c72425dd3b116b146333c;hpb=b661daf1160a873609d70843999cd46eff25d1f0;p=ncurses.git diff --git a/menu/m_post.c b/menu/m_post.c index b4b1bc14..cb802304 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2020,2021 Thomas E. Dickey * + * Copyright 2020-2021,2022 Thomas E. Dickey * * Copyright 1998-2010,2012 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -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.38 2022/09/24 09:38:44 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -203,7 +203,6 @@ _nc_Draw_Menu(const MENU *menu) ITEM *item = menu->items[0]; ITEM *lastvert; ITEM *hitem; - int y = 0; chtype s_bkgd; assert(item && menu->win); @@ -215,45 +214,50 @@ _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; + int y = 0; 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)); } /*---------------------------------------------------------------------------