2018-03-16 11:45:52 +01:00
|
|
|
---
|
2019-01-09 14:02:42 +01:00
|
|
|
lib/readline/bind.c | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
|
|
|
|
lib/readline/doc/rluser.texi | 3 ++-
|
|
|
|
lib/readline/rlconf.h | 2 +-
|
2018-03-16 11:45:52 +01:00
|
|
|
3 files changed, 47 insertions(+), 13 deletions(-)
|
|
|
|
|
|
|
|
--- lib/readline/bind.c
|
2019-01-09 14:02:42 +01:00
|
|
|
+++ lib/readline/bind.c 2018-11-29 08:33:08.921317296 +0000
|
|
|
|
@@ -850,6 +850,9 @@ rl_function_of_keyseq_len (const char *k
|
2018-03-16 11:45:52 +01:00
|
|
|
/* The last key bindings file read. */
|
|
|
|
static char *last_readline_init_file = (char *)NULL;
|
|
|
|
|
|
|
|
+/* Flag to read system init file */
|
|
|
|
+static int read_system_init_file = 0;
|
|
|
|
+
|
|
|
|
/* The file we're currently reading key bindings from. */
|
|
|
|
static const char *current_readline_init_file;
|
|
|
|
static int current_readline_init_include_level;
|
2019-01-09 14:02:42 +01:00
|
|
|
@@ -917,11 +920,14 @@ rl_re_read_init_file (int count, int ign
|
2018-03-16 11:45:52 +01:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
+/* Forward declarations */
|
|
|
|
+static int sv_bell_style PARAMS((const char *));
|
|
|
|
+
|
|
|
|
/* Do key bindings from a file. If FILENAME is NULL it defaults
|
|
|
|
to the first non-null filename from this list:
|
|
|
|
1. the filename used for the previous call
|
|
|
|
2. the value of the shell variable `INPUTRC'
|
|
|
|
- 3. ~/.inputrc
|
|
|
|
+ 3. /etc/inputrc and ~/.inputrc
|
|
|
|
4. /etc/inputrc
|
|
|
|
If the file existed and could be opened and read, 0 is returned,
|
|
|
|
otherwise errno is returned. */
|
2019-01-09 14:02:42 +01:00
|
|
|
@@ -930,18 +936,39 @@ rl_read_init_file (const char *filename)
|
2018-03-16 11:45:52 +01:00
|
|
|
{
|
|
|
|
/* Default the filename. */
|
|
|
|
if (filename == 0)
|
|
|
|
- filename = last_readline_init_file;
|
|
|
|
- if (filename == 0)
|
|
|
|
- filename = sh_get_env_value ("INPUTRC");
|
|
|
|
- if (filename == 0 || *filename == 0)
|
|
|
|
+ {
|
|
|
|
+ filename = last_readline_init_file;
|
|
|
|
+ if (filename == 0)
|
|
|
|
+ {
|
|
|
|
+ filename = sh_get_env_value ("INPUTRC");
|
|
|
|
+ read_system_init_file = 0;
|
|
|
|
+ }
|
|
|
|
+ if (filename == 0)
|
|
|
|
+ {
|
|
|
|
+ filename = DEFAULT_INPUTRC;
|
|
|
|
+ read_system_init_file = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (*filename == 0)
|
|
|
|
{
|
|
|
|
filename = DEFAULT_INPUTRC;
|
|
|
|
- /* Try to read DEFAULT_INPUTRC; fall back to SYS_INPUTRC on failure */
|
|
|
|
- if (_rl_read_init_file (filename, 0) == 0)
|
|
|
|
- return 0;
|
|
|
|
- filename = SYS_INPUTRC;
|
|
|
|
+ read_system_init_file = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ sv_bell_style(sh_get_env_value("DEFAULT_BELL_STYLE"));
|
|
|
|
+
|
|
|
|
+ if (read_system_init_file)
|
|
|
|
+ if (filename == last_readline_init_file)
|
|
|
|
+ {
|
|
|
|
+ filename = savestring (filename);
|
|
|
|
+ _rl_read_init_file (SYS_INPUTRC, 0);
|
|
|
|
+ free (last_readline_init_file);
|
|
|
|
+ last_readline_init_file = filename;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ _rl_read_init_file (SYS_INPUTRC, 0);
|
|
|
|
+
|
|
|
|
#if defined (__MSDOS__)
|
|
|
|
if (_rl_read_init_file (filename, 0) == 0)
|
|
|
|
return 0;
|
2019-01-09 14:02:42 +01:00
|
|
|
@@ -1681,7 +1708,14 @@ remove_trailing:
|
2018-03-16 11:45:52 +01:00
|
|
|
rl_macro_bind (seq, &funname[1], _rl_keymap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
- rl_bind_keyseq (seq, rl_named_function (funname));
|
|
|
|
+ {
|
|
|
|
+#if defined (PREFIX_META_HACK)
|
|
|
|
+ if (_rl_stricmp (funname, "prefix-meta") == 0)
|
|
|
|
+ rl_generic_bind (ISKMAP, seq, (char *)emacs_meta_keymap, _rl_keymap);
|
|
|
|
+ else
|
|
|
|
+#endif
|
|
|
|
+ rl_bind_keyseq (seq, rl_named_function (funname));
|
|
|
|
+ }
|
|
|
|
|
|
|
|
xfree (seq);
|
|
|
|
return 0;
|
2019-01-09 14:02:42 +01:00
|
|
|
@@ -1850,7 +1884,6 @@ typedef int _rl_sv_func_t PARAMS((const
|
2018-03-16 11:45:52 +01:00
|
|
|
#define V_INT 2
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
-static int sv_bell_style PARAMS((const char *));
|
|
|
|
static int sv_combegin PARAMS((const char *));
|
|
|
|
static int sv_dispprefix PARAMS((const char *));
|
|
|
|
static int sv_compquery PARAMS((const char *));
|
|
|
|
--- lib/readline/doc/rluser.texi
|
2019-01-09 14:02:42 +01:00
|
|
|
+++ lib/readline/doc/rluser.texi 2018-11-29 08:33:08.921317296 +0000
|
2018-03-16 11:45:52 +01:00
|
|
|
@@ -349,7 +349,8 @@ file is taken from the value of the envi
|
|
|
|
@end ifclear
|
|
|
|
that variable is unset, the default is @file{~/.inputrc}. If that
|
|
|
|
file does not exist or cannot be read, the ultimate default is
|
|
|
|
-@file{/etc/inputrc}.
|
|
|
|
+@file{/etc/inputrc}. If both @file{~/.inputrc} and @file{/etc/inputrc}
|
|
|
|
+exist Readline will read first @file{/etc/inputrc} and then @file{~/.inputrc}.
|
|
|
|
|
|
|
|
When a program which uses the Readline library starts up, the
|
|
|
|
init file is read, and the key bindings are set.
|
|
|
|
--- lib/readline/rlconf.h
|
2019-01-09 14:02:42 +01:00
|
|
|
+++ lib/readline/rlconf.h 2018-11-29 08:33:08.921317296 +0000
|
2018-03-16 11:45:52 +01:00
|
|
|
@@ -37,7 +37,7 @@
|
|
|
|
#define HANDLE_SIGNALS
|
|
|
|
|
|
|
|
/* Ugly but working hack for binding prefix meta. */
|
|
|
|
-#define PREFIX_META_HACK
|
|
|
|
+#undef PREFIX_META_HACK
|
|
|
|
|
|
|
|
/* The next-to-last-ditch effort file name for a user-specific init file. */
|
|
|
|
#define DEFAULT_INPUTRC "~/.inputrc"
|