sure that the history position is at the end of the history before
calling _rl_revert_all_lines(). Fixes bug reported by
johnlinp@gmail.com and frederik@ofb.net
+
+ 2/4
+ ---
+builtins/complete.def
+ - complete_builtin: fix check for argument to -F to use strpbrk
+ instead of incomplete use of strcspn. Fix from Grisha Levit
+ <grishalevit@gmail.com>
+
+ 2/5
+ ---
+lib/readline/readline.c
+ - rl_parse_and_bind: change parsing of boolean variable values to
+ look for and consume an optional whitespace-delimited word. This
+ allows trailing spaces and everything that follows to work. Idea
+ from Bize Ma <binaryzebra@gmail.com>
+ - rl_parse_and_bind: print error message about unknown variable names
+ instead of calling rl_variable_bind to do it
+ - rl_variable_bind: report error if setting string variable returns
+ non-zero
+
+ 2/6
+ ---
+lib/readline/histfile.c
+ - read_history_range: close FILE before returning if the history file
+ size is 0
/* bind.c -- key binding and startup file support for the readline library. */
-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 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.
/* Strip trailing whitespace from values of boolean variables. */
if (find_boolean_var (var) >= 0)
{
- /* remove trailing whitespace */
-remove_trailing:
- e = value + strlen (value) - 1;
- while (e >= value && whitespace (*e))
- e--;
- e++; /* skip back to whitespace or EOS */
-
- if (*e && e >= value)
- *e = '\0';
+ /* just read a whitespace-delimited word or empty string */
+ for (e = value; *e && whitespace (*e) == 0; e++)
+ ;
+ if (e > value)
+ *e = '\0'; /* cut off everything trailing */
}
else if ((i = find_string_var (var)) >= 0)
{
value++; /* skip past the quote */
}
else
- goto remove_trailing;
+ {
+ /* remove trailing whitespace */
+ e = value + strlen (value) - 1;
+ while (e >= value && whitespace (*e))
+ e--;
+ e++; /* skip back to whitespace or EOS */
+
+ if (*e && e >= value)
+ *e = '\0';
+ }
+ }
+ else
+ {
+ /* avoid calling rl_variable_bind just to find this out */
+ _rl_init_file_error ("%s: unknown variable name", var);
+ return 1;
}
-
+
rl_variable_bind (var, value);
return 0;
}
}
/* A boolean value that can appear in a `set variable' command is true if
- the value is null or empty, `on' (case-insensitive), or "1". Any other
+ the value is null or empty, `on' (case-insensitive), or "1". All other
values result in 0 (false). */
static int
bool_to_int (const char *value)
return (_rl_get_string_variable_value (string_varlist[i].name));
/* Unknown variable names return NULL. */
- return 0;
+ return (char *)NULL;
}
int
}
v = (*string_varlist[i].set_func) (value);
+ if (v != 0)
+ _rl_init_file_error ("%s: could not set value to `%s'", name, value);
return v;
}