/* bind.c -- key binding and startup file support for the readline library. */
-/* Copyright (C) 1987-2010 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2012 Free Software Foundation, Inc.
This file is part of the GNU Readline Library (Readline), a library
for reading lines of text with interactive input and history editing.
return (0);
}
+static int
+_rl_isescape (c)
+ int c;
+{
+ switch (c)
+ {
+ case '\007':
+ case '\b':
+ case '\f':
+ case '\n':
+ case '\r':
+ case TAB:
+ case 0x0b: return (1);
+ default: return (0);
+ }
+}
+
+static int
+_rl_escchar (c)
+ int c;
+{
+ switch (c)
+ {
+ case '\007': return ('a');
+ case '\b': return ('b');
+ case '\f': return ('f');
+ case '\n': return ('n');
+ case '\r': return ('r');
+ case TAB: return ('t');
+ case 0x0b: return ('v');
+ default: return (c);
+ }
+}
+
char *
rl_untranslate_keyseq (seq)
int seq;
return kseq;
}
-static char *
-_rl_untranslate_macro_value (seq)
+char *
+_rl_untranslate_macro_value (seq, use_escapes)
char *seq;
+ int use_escapes;
{
char *ret, *r, *s;
int c;
else if (CTRL_CHAR (c))
{
*r++ = '\\';
- *r++ = 'C';
- *r++ = '-';
- c = _rl_to_lower (UNCTRL (c));
+ if (use_escapes && _rl_isescape (c))
+ c = _rl_escchar (c);
+ else
+ {
+ *r++ = 'C';
+ *r++ = '-';
+ c = _rl_to_lower (UNCTRL (c));
+ }
}
else if (c == RUBOUT)
{
{
i = _rl_skip_to_delim (value, 1, *value);
value[i] = '\0';
+ value++; /* skip past the quote */
}
else
goto remove_trailing;
{ "bind-tty-special-chars", &_rl_bind_stty_chars, 0 },
{ "blink-matching-paren", &rl_blink_matching_paren, V_SPECIAL },
{ "byte-oriented", &rl_byte_oriented, 0 },
+#if defined (COLOR_SUPPORT)
+ { "colored-stats", &_rl_colored_stats, 0 },
+#endif
{ "completion-ignore-case", &_rl_completion_case_fold, 0 },
{ "completion-map-case", &_rl_completion_case_map, 0 },
{ "convert-meta", &_rl_convert_meta_chars_to_ascii, 0 },
{ "revert-all-at-newline", &_rl_revert_all_at_newline, 0 },
{ "show-all-if-ambiguous", &_rl_complete_show_all, 0 },
{ "show-all-if-unmodified", &_rl_complete_show_unmodified, 0 },
+ { "show-mode-in-prompt", &_rl_show_mode_in_prompt, 0 },
{ "skip-completed-text", &_rl_skip_completed_text, 0 },
#if defined (VISIBLE_STATS)
{ "visible-stats", &rl_visible_stats, 0 },
else
_rl_bell_preference = AUDIBLE_BELL;
}
+ else if (_rl_stricmp (name, "show-mode-in-prompt") == 0)
+ _rl_reset_prompt ();
}
typedef int _rl_sv_func_t PARAMS((const char *));
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
static int sv_keymap PARAMS((const char *));
+static int sv_seqtimeout PARAMS((const char *));
static const struct {
const char * const name;
{ "history-size", V_INT, sv_histsize },
{ "isearch-terminators", V_STRING, sv_isrchterm },
{ "keymap", V_STRING, sv_keymap },
+ { "keyseq-timeout", V_INT, sv_seqtimeout },
{ (char *)NULL, 0, (_rl_sv_func_t *)0 }
};
sv_histsize (value)
const char *value;
{
- int nval = 500;
+ int nval;
+ nval = 500;
if (value && *value)
{
nval = atoi (value);
if (nval < 0)
- return 1;
+ {
+ unstifle_history ();
+ return 0;
+ }
}
stifle_history (nval);
return 0;
return 1;
}
+static int
+sv_seqtimeout (value)
+ const char *value;
+{
+ int nval;
+
+ nval = 0;
+ if (value && *value)
+ {
+ nval = atoi (value);
+ if (nval < 0)
+ nval = 0;
+ }
+ _rl_keyseq_timeout = nval;
+ return 0;
+}
+
static int
sv_bell_style (value)
const char *value;
{
case ISMACR:
keyname = _rl_get_keyname (key);
- out = _rl_untranslate_macro_value ((char *)map[key].function);
+ out = _rl_untranslate_macro_value ((char *)map[key].function, 0);
if (print_readably)
fprintf (rl_outstream, "\"%s%s\": \"%s\"\n", prefix ? prefix : "",
{
if (_rl_isearch_terminators == 0)
return 0;
- ret = _rl_untranslate_macro_value (_rl_isearch_terminators);
+ ret = _rl_untranslate_macro_value (_rl_isearch_terminators, 0);
if (ret)
{
strncpy (numbuf, ret, sizeof (numbuf) - 1);
ret = rl_get_keymap_name_from_edit_mode ();
return (ret ? ret : "none");
}
+ else if (_rl_stricmp (name, "keyseq-timeout") == 0)
+ {
+ sprintf (numbuf, "%d", _rl_keyseq_timeout);
+ return (numbuf);
+ }
else
return (0);
}