Module Name:    src
Committed By:   martin
Date:           Fri Jan  4 15:27:19 UTC 2019

Modified Files:
        src/usr.bin/menuc: mdb.c menu_sys.def menuc.1

Log Message:
Add an option for single (disabled) menu lines to have no shortcut.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/menuc/mdb.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/menuc/menu_sys.def
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/menuc/menuc.1

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

Modified files:

Index: src/usr.bin/menuc/mdb.c
diff -u src/usr.bin/menuc/mdb.c:1.47 src/usr.bin/menuc/mdb.c:1.48
--- src/usr.bin/menuc/mdb.c:1.47	Wed Nov 21 20:04:48 2018
+++ src/usr.bin/menuc/mdb.c	Fri Jan  4 15:27:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdb.c,v 1.47 2018/11/21 20:04:48 martin Exp $	*/
+/*	$NetBSD: mdb.c,v 1.48 2019/01/04 15:27:19 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -41,7 +41,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mdb.c,v 1.47 2018/11/21 20:04:48 martin Exp $");
+__RCSID("$NetBSD: mdb.c,v 1.48 2019/01/04 15:27:19 martin Exp $");
 #endif
 
 
@@ -184,6 +184,7 @@ write_menu_file(char *initcode)
 		"#define OPT_ENDWIN	2\n"
 		"#define OPT_EXIT	4\n"
 		"#define OPT_IGNORE	8\n"
+		"#define OPT_NOSHORT	16\n"
 		"#define OPT_NOMENU	-1\n\n"
 		"struct menudesc {\n"
 		"	const char	*title;\n"

Index: src/usr.bin/menuc/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.61 src/usr.bin/menuc/menu_sys.def:1.62
--- src/usr.bin/menuc/menu_sys.def:1.61	Wed Jan  2 16:32:59 2019
+++ src/usr.bin/menuc/menu_sys.def	Fri Jan  4 15:27:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menu_sys.def,v 1.61 2019/01/02 16:32:59 martin Exp $	*/
+/*	$NetBSD: menu_sys.def,v 1.62 2019/01/04 15:27:19 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -301,14 +301,18 @@ static void
 draw_menu_line(menudesc *m, int opt, int cury, void *arg, const char *text)
 {
 	int hasbox = m->mopt & MC_NOBOX ? 0 : 1;
+	int noshort = (opt < m->numopts)
+	    && (m->opts[opt].opt_flags & OPT_NOSHORT);
 
 	if (m->cursel == opt) {
 		mvwaddstr(m->mw, cury, hasbox, ">");
 		wstandout(m->mw);
 	} else
 		mvwaddstr(m->mw, cury, hasbox, " ");
-	if (!(m->mopt & MC_NOSHORTCUT))
+	if (!(m->mopt & MC_NOSHORTCUT) && !noshort)
 		wprintw(m->mw, "%c: ", opt_ch(m, opt));
+	else if (!(m->mopt & MC_NOSHORTCUT))
+		wprintw(m->mw, "   ");
 
 	if (!text && m->draw_line)
 		m->draw_line(m, opt, arg);

Index: src/usr.bin/menuc/menuc.1
diff -u src/usr.bin/menuc/menuc.1:1.33 src/usr.bin/menuc/menuc.1:1.34
--- src/usr.bin/menuc/menuc.1:1.33	Wed Nov 21 22:42:26 2018
+++ src/usr.bin/menuc/menuc.1	Fri Jan  4 15:27:19 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: menuc.1,v 1.33 2018/11/21 22:42:26 uwe Exp $
+.\"	$NetBSD: menuc.1,v 1.34 2019/01/04 15:27:19 martin Exp $
 .\"
 .\" Copyright 1997 Piermont Information Systems Inc.
 .\" All rights reserved.
@@ -424,9 +424,11 @@ struct menu_ent {
 #define OPT_NOMENU -1
 
 /* For opt_flags */
-#define OPT_SUB    1
-#define OPT_ENDWIN 2
-#define OPT_EXIT   4
+#define OPT_SUB     1
+#define OPT_ENDWIN  2
+#define OPT_EXIT    4
+#define OPT_IGNORE  8
+#define OPT_NOSHORT 16
 
 typedef
 struct menudesc {

Reply via email to