Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/menuc Add an option for single (disabled) menu lines...



details:   https://anonhg.NetBSD.org/src/rev/16b375a857b1
branches:  trunk
changeset: 447209:16b375a857b1
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jan 04 15:27:19 2019 +0000

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

diffstat:

 usr.bin/menuc/mdb.c        |   5 +++--
 usr.bin/menuc/menu_sys.def |   8 ++++++--
 usr.bin/menuc/menuc.1      |  10 ++++++----
 3 files changed, 15 insertions(+), 8 deletions(-)

diffs (79 lines):

diff -r e3bfabb53d5c -r 16b375a857b1 usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Fri Jan 04 10:25:39 2019 +0000
+++ b/usr.bin/menuc/mdb.c       Fri Jan 04 15:27:19 2019 +0000
@@ -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 @@
                "#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"
diff -r e3bfabb53d5c -r 16b375a857b1 usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Fri Jan 04 10:25:39 2019 +0000
+++ b/usr.bin/menuc/menu_sys.def        Fri Jan 04 15:27:19 2019 +0000
@@ -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 @@
 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);
diff -r e3bfabb53d5c -r 16b375a857b1 usr.bin/menuc/menuc.1
--- a/usr.bin/menuc/menuc.1     Fri Jan 04 10:25:39 2019 +0000
+++ b/usr.bin/menuc/menuc.1     Fri Jan 04 15:27:19 2019 +0000
@@ -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 @@
 #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 {



Home | Main Index | Thread Index | Old Index