Fix bug where menu mark was not displayed on menus with O_ONEVALUE set

Set a default menu mark
This commit is contained in:
blymn 2012-12-30 12:27:09 +00:00
parent 16ff83dd36
commit c58c21e5d2
2 changed files with 15 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: internals.c,v 1.15 2012/06/27 11:53:36 blymn Exp $ */
/* $NetBSD: internals.c,v 1.16 2012/12/30 12:27:09 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: internals.c,v 1.15 2012/06/27 11:53:36 blymn Exp $");
__RCSID("$NetBSD: internals.c,v 1.16 2012/12/30 12:27:09 blymn Exp $");
#include <menu.h>
#include <ctype.h>
@ -446,7 +446,9 @@ _menui_draw_item(MENU *menu, int item)
* all others unless the menu unmark string is set in which
* case the unmark string is written.
*/
if (menu->items[item]->selected == 1) {
if ((menu->items[item]->selected == 1) ||
(((menu->opts & O_ONEVALUE) == O_ONEVALUE) &&
(menu->cur_item == item))) {
if (menu->mark.string != NULL) {
for (j = 0; j < menu->mark.length; j++) {
waddch(menu->scrwin,

View File

@ -1,4 +1,4 @@
/* $NetBSD: menu.c,v 1.17 2012/03/21 05:33:27 matt Exp $ */
/* $NetBSD: menu.c,v 1.18 2012/12/30 12:27:09 blymn Exp $ */
/*-
* Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au)
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: menu.c,v 1.17 2012/03/21 05:33:27 matt Exp $");
__RCSID("$NetBSD: menu.c,v 1.18 2012/12/30 12:27:09 blymn Exp $");
#include <ctype.h>
#include <menu.h>
@ -445,7 +445,8 @@ MENU *
new_menu(ITEM **items)
{
MENU *the_menu;
char mark[2];
if ((the_menu = (MENU *)malloc(sizeof(MENU))) == NULL)
return NULL;
@ -483,6 +484,12 @@ new_menu(ITEM **items)
(unsigned) _menui_default_menu.unmark.length+ 1 );
}
/* default mark needs to be set */
mark[0] = '-';
mark[1] = '\0';
set_menu_mark(the_menu, mark);
/* now attach the items, if any */
if (items != NULL) {
if(set_menu_items(the_menu, items) < 0) {