Module Name:    src
Committed By:   blymn
Date:           Sun Dec 30 12:27:09 UTC 2012

Modified Files:
        src/lib/libmenu: internals.c menu.c

Log Message:
Fix bug where menu mark was not displayed on menus with O_ONEVALUE set
Set a default menu mark


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libmenu/internals.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libmenu/menu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libmenu/internals.c
diff -u src/lib/libmenu/internals.c:1.15 src/lib/libmenu/internals.c:1.16
--- src/lib/libmenu/internals.c:1.15	Wed Jun 27 11:53:36 2012
+++ src/lib/libmenu/internals.c	Sun Dec 30 12:27:09 2012
@@ -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 ([email protected], [email protected])
@@ -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,

Index: src/lib/libmenu/menu.c
diff -u src/lib/libmenu/menu.c:1.17 src/lib/libmenu/menu.c:1.18
--- src/lib/libmenu/menu.c:1.17	Wed Mar 21 05:33:27 2012
+++ src/lib/libmenu/menu.c	Sun Dec 30 12:27:09 2012
@@ -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 ([email protected], [email protected])
@@ -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) {

Reply via email to