about summary refs log tree commit diff stats
path: root/src/LYKeymap.c
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2014-12-09 01:49:51 -0500
committerThomas E. Dickey <dickey@invisible-island.net>2014-12-09 01:49:51 -0500
commitde7435038b32689d955ea0e9c8ad2b9c86326412 (patch)
tree6d55883673c79a4150a43968d983b30b030d697c /src/LYKeymap.c
parentbaca62834b1c8afb0f3f05f4d5b9255979221948 (diff)
downloadlynx-snapshots-de7435038b32689d955ea0e9c8ad2b9c86326412.tar.gz
snapshot of project "lynx", label v2-8-9dev_1h
Diffstat (limited to 'src/LYKeymap.c')
-rw-r--r--src/LYKeymap.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/LYKeymap.c b/src/LYKeymap.c
index 20d7f101..c8d3a6c0 100644
--- a/src/LYKeymap.c
+++ b/src/LYKeymap.c
@@ -1,4 +1,4 @@
-/* $LynxId: LYKeymap.c,v 1.110 2013/12/17 00:27:55 tom Exp $ */
+/* $LynxId: LYKeymap.c,v 1.113 2014/12/09 01:48:50 tom Exp $ */
 #include <HTUtils.h>
 #include <LYUtils.h>
 #include <LYGlobalDefs.h>
@@ -967,7 +967,7 @@ int lkcstring_to_lkc(const char *src)
 	    c = (-1);
 #ifdef USE_KEYMAPS
     } else {
-	map_string_to_keysym(src, &c);
+	map_string_to_keysym(src, &c, TRUE);
 #ifndef USE_SLANG
 	if (c >= 0) {
 	    /* make curses-keys mapped from Keysym_Strings[] available here */
@@ -1059,39 +1059,37 @@ int remap(char *key,
 {
     Kcmd *mp;
     int c;
+    int result = 0;
 
 #if !defined(DIRED_SUPPORT) || !defined(OK_OVERRIDE)
-    if (for_dired)
-	return 0;
-#endif
-    if (func == NULL)
-	return 0;
-    c = lkcstring_to_lkc(key);
-    if (c <= -1)
-	return 0;
-    else if (c >= 0) {
-	/* Remapping of key actions is supported only for basic
-	 * lynxkeycodes, without modifiers etc.!  If we get somehow
-	 * called for an invalid lynxkeycode, fail or silently ignore
-	 * modifiers. - kw
-	 */
-	if (c & (LKC_ISLECLAC | LKC_ISLAC))
-	    return 0;
-	if ((c & LKC_MASK) != c)
-	    c &= LKC_MASK;
+    if (for_dired) {
+	return result;
     }
-    if (c + 1 >= KEYMAP_SIZE)
-	return 0;
-    if ((mp = LYStringToKcmd(func)) != 0) {
+#endif
+    if (func != NULL) {
+	c = lkcstring_to_lkc(key);
+	if ((c >= 0) && (c < KEYMAP_SIZE)) {
+	    /* Remapping of key actions is supported only for basic
+	     * lynxkeycodes, without modifiers etc.!  If we get somehow
+	     * called for an invalid lynxkeycode, fail or silently ignore
+	     * modifiers -KW
+	     */
+	    if (!(c & (LKC_ISLECLAC | LKC_ISLAC))) {
+		c &= LKC_MASK;
+		if ((mp = LYStringToKcmd(func)) != 0) {
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
-	if (for_dired)
-	    key_override[c + 1] = mp->code;
-	else
+		    if (for_dired)
+			key_override[c + 1] = mp->code;
+		    else
 #endif
-	    keymap[c + 1] = (LYKeymap_t) mp->code;
-	return (c ? c : (int) LAC_TO_LKC0(mp->code));	/* don't return 0, successful */
+			keymap[c + 1] = (LYKeymap_t) mp->code;
+		    /* don't return 0, successful */
+		    result = (c ? c : (int) LAC_TO_LKC0(mp->code));
+		}
+	    }
+	}
     }
-    return 0;
+    return result;
 }
 
 typedef struct {
@@ -1529,6 +1527,7 @@ static void initKeyMap(LYEditConfig * table)
  */
 void LYinitKeymap(void)
 {
+    CTRACE((tfp, "LYinitKeymap\n"));
     initKeyMap(&myKeymapData);
 #if defined(DIRED_SUPPORT) && defined(OK_OVERRIDE)
     initKeyMap(&myOverrideData);