Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libmenu Fix bug where menu mark was not displayed on men...



details:   https://anonhg.NetBSD.org/src/rev/65ce5b3fcb44
branches:  trunk
changeset: 783579:65ce5b3fcb44
user:      blymn <blymn%NetBSD.org@localhost>
date:      Sun Dec 30 12:27:09 2012 +0000

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

diffstat:

 lib/libmenu/internals.c |   8 +++++---
 lib/libmenu/menu.c      |  13 ++++++++++---
 2 files changed, 15 insertions(+), 6 deletions(-)

diffs (70 lines):

diff -r 88a52f94a600 -r 65ce5b3fcb44 lib/libmenu/internals.c
--- a/lib/libmenu/internals.c   Sun Dec 30 10:04:22 2012 +0000
+++ b/lib/libmenu/internals.c   Sun Dec 30 12:27:09 2012 +0000
@@ -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@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -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 @@
           * 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,
diff -r 88a52f94a600 -r 65ce5b3fcb44 lib/libmenu/menu.c
--- a/lib/libmenu/menu.c        Sun Dec 30 10:04:22 2012 +0000
+++ b/lib/libmenu/menu.c        Sun Dec 30 12:27:09 2012 +0000
@@ -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@localhost, brett_lymn%yahoo.com.au@localhost)
@@ -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 @@
 new_menu(ITEM **items)
 {
         MENU *the_menu;
-        
+        char mark[2];
+
         if ((the_menu = (MENU *)malloc(sizeof(MENU))) == NULL)
                 return NULL;
 
@@ -483,6 +484,12 @@
                        (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) {



Home | Main Index | Thread Index | Old Index