diff -rc readline-4.2/bind.c readline-4.2-new/bind.c *** readline-4.2/bind.c Mon Mar 5 10:10:07 2001 --- readline-4.2-new/bind.c Fri Aug 17 14:46:18 2001 *************** *** 246,251 **** --- 246,254 ---- char *keys; int keys_len; register int i; + KEYMAP_ENTRY k; + + k.function = NULL; /* If no keys to bind to, exit right away. */ if (!keyseq || !*keyseq) *************** *** 282,299 **** { if (map[ic].type != ISKMAP) { ! if (map[ic].type == ISMACR) ! free ((char *)map[ic].function); map[ic].type = ISKMAP; map[ic].function = KEYMAP_TO_FUNCTION (rl_make_bare_keymap()); } map = FUNCTION_TO_KEYMAP (map, ic); } else { if (map[ic].type == ISMACR) ! free ((char *)map[ic].function); map[ic].function = KEYMAP_TO_FUNCTION (data); map[ic].type = type; --- 285,313 ---- { if (map[ic].type != ISKMAP) { ! k = map[ic]; map[ic].type = ISKMAP; map[ic].function = KEYMAP_TO_FUNCTION (rl_make_bare_keymap()); } map = FUNCTION_TO_KEYMAP (map, ic); + if (k.type == ISFUNC && k.function != NULL) + { + map[ANYOTHERKEY] = k; + k.function=NULL; + } } else { if (map[ic].type == ISMACR) ! { ! free ((char *)map[ic].function); ! } ! else if (map[ic].type == ISKMAP) ! { ! map = FUNCTION_TO_KEYMAP(map, ic); ! ic = ANYOTHERKEY; ! } map[ic].function = KEYMAP_TO_FUNCTION (data); map[ic].type = type; diff -rc readline-4.2/chardefs.h readline-4.2-new/chardefs.h *** readline-4.2/chardefs.h Wed Sep 13 17:20:15 2000 --- readline-4.2-new/chardefs.h Mon Aug 20 10:07:53 2001 *************** *** 132,137 **** --- 132,139 ---- # define isxdigit(c) (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) #endif + #define ANYOTHERKEY (largest_char+1) + #define HEXVALUE(c) \ (((c) >= 'a' && (c) <= 'f') \ ? (c)-'a'+10 \ Only in readline-4.2/doc: rluserman.dvi diff -rc readline-4.2/input.c readline-4.2-new/input.c *** readline-4.2/input.c Tue Mar 27 10:15:04 2001 --- readline-4.2-new/input.c Fri Aug 17 16:06:06 2001 *************** *** 134,141 **** /* Stuff KEY into the *front* of the input buffer. Returns non-zero if successful, zero if there is no space left in the buffer. */ ! static int ! rl_unget_char (key) int key; { if (ibuffer_space ()) --- 134,141 ---- /* Stuff KEY into the *front* of the input buffer. Returns non-zero if successful, zero if there is no space left in the buffer. */ ! int ! _rl_unget_char (key) int key; { if (ibuffer_space ()) *************** *** 287,293 **** string[i++] = key; if (t) ! rl_unget_char (key); string[i] = '\0'; rl_insert_text (string); --- 287,293 ---- string[i++] = key; if (t) ! _rl_unget_char (key); string[i] = '\0'; rl_insert_text (string); diff -rc readline-4.2/keymaps.h readline-4.2-new/keymaps.h *** readline-4.2/keymaps.h Mon Oct 30 13:23:23 2000 --- readline-4.2-new/keymaps.h Fri Aug 17 14:41:53 2001 *************** *** 49,56 **** /* This must be large enough to hold bindings for all of the characters in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, ! and so on). */ ! #define KEYMAP_SIZE 256 /* I wanted to make the above structure contain a union of: union { rl_command_func_t *function; struct _keymap_entry *keymap; } value; --- 49,56 ---- /* This must be large enough to hold bindings for all of the characters in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x, ! and so on) plus 1 to represent any other character. */ ! #define KEYMAP_SIZE 257 /* I wanted to make the above structure contain a union of: union { rl_command_func_t *function; struct _keymap_entry *keymap; } value; Only in readline-4.2-new: o diff -rc readline-4.2/readline.c readline-4.2-new/readline.c *** readline-4.2/readline.c Mon Apr 2 15:56:20 2001 --- readline-4.2-new/readline.c Mon Aug 20 10:30:35 2001 *************** *** 511,516 **** --- 511,524 ---- register int key; Keymap map; { + return _rl_dispatch_r(key, map, 0); + } + + int + _rl_dispatch_r (key, map, got_subseq) + register int key; + Keymap map; + { int r, newkey; char *macro; rl_command_func_t *func; *************** *** 563,568 **** --- 571,586 ---- if (rl_pending_input == 0 && map[key].function != rl_digit_argument) rl_last_func = map[key].function; } + else if (map[ANYOTHERKEY].function) + { + _rl_unget_char(key); + return -2; + } + else if (got_subseq) + { + _rl_unget_char(key); + return -1; + } else { _rl_abort_internal (); *************** *** 583,589 **** if (key == ESC) RL_UNSETSTATE(RL_STATE_METANEXT); ! r = _rl_dispatch (newkey, FUNCTION_TO_KEYMAP (map, key)); } else { --- 601,621 ---- if (key == ESC) RL_UNSETSTATE(RL_STATE_METANEXT); ! r = _rl_dispatch_r (newkey, FUNCTION_TO_KEYMAP (map, key), got_subseq||map[ANYOTHERKEY].function); ! if (r == -2) ! { ! r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)); ! } ! else if (r && map[ANYOTHERKEY].function) ! { ! _rl_unget_char(key); ! return -2; ! } ! else if (r && got_subseq) ! { ! _rl_unget_char(key); ! return -1; ! } } else { diff -rc readline-4.2/rlprivate.h readline-4.2-new/rlprivate.h *** readline-4.2/rlprivate.h Wed Feb 14 07:43:14 2001 --- readline-4.2-new/rlprivate.h Fri Aug 17 15:38:05 2001 *************** *** 136,141 **** --- 136,142 ---- extern int _rl_any_typein __P((void)); extern int _rl_input_available __P((void)); extern void _rl_insert_typein __P((int)); + extern int _rl_unget_char __P((int)); /* macro.c */ extern void _rl_with_macro_input __P((char *));