Source-Changes-HG archive

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

[src/trunk]: src/lib/libcurses Fix deleting a key definition, it did not work...



details:   https://anonhg.NetBSD.org/src/rev/21d6f9402c0d
branches:  trunk
changeset: 764422:21d6f9402c0d
user:      blymn <blymn%NetBSD.org@localhost>
date:      Thu Apr 21 08:10:49 2011 +0000

description:
Fix deleting a key definition, it did not work.  Also improve tracing
of key definition deletion.

diffstat:

 lib/libcurses/getch.c |  25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diffs (54 lines):

diff -r 068f2e4b0557 -r 21d6f9402c0d lib/libcurses/getch.c
--- a/lib/libcurses/getch.c     Thu Apr 21 06:58:31 2011 +0000
+++ b/lib/libcurses/getch.c     Thu Apr 21 08:10:49 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getch.c,v 1.57 2010/12/07 22:02:52 joerg Exp $ */
+/*     $NetBSD: getch.c,v 1.58 2011/04/21 08:10:49 blymn Exp $ */
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)getch.c    8.2 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: getch.c,v 1.57 2010/12/07 22:02:52 joerg Exp $");
+__RCSID("$NetBSD: getch.c,v 1.58 2011/04/21 08:10:49 blymn Exp $");
 #endif
 #endif                                 /* not lint */
 
@@ -365,14 +365,11 @@
                                _cursesi_free_keymap(key->value.next);
                } else if ((key->type == KEYMAP_LEAF)
                           && (key->value.symbol == key_type)) {
-                         /*
-                          * delete the mapping by negating the current
-                          * index - this "holds" the position in the
-                          * allocation just in case we later re-add
-                          * the key for that mapping.
-                          */
-                       current->mapping[i] = - current->mapping[i];
-                       current->count--;
+#ifdef DEBUG
+               __CTRACE(__CTRACE_INPUT, "delete_key_sequence: found keysym %d, deleting\n",
+                   key_type);
+#endif
+                       key->enable = FALSE;
                }
        }
 }
@@ -783,9 +780,13 @@
        if (symbol <= 0)
                return ERR;
 
-       if (sequence == NULL)
+       if (sequence == NULL) {
+#ifdef DEBUG
+               __CTRACE(__CTRACE_INPUT, "define_key: deleting keysym %d\n",
+                   symbol);
+#endif
                delete_key_sequence(_cursesi_screen->base_keymap, symbol);
-       else
+       } else
                add_key_sequence(_cursesi_screen, sequence, symbol);
 
        return OK;



Home | Main Index | Thread Index | Old Index