summaryrefslogtreecommitdiff
path: root/lib/readline/histfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/readline/histfile.c')
-rw-r--r--lib/readline/histfile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/readline/histfile.c b/lib/readline/histfile.c
index 717bbee6..2f051a32 100644
--- a/lib/readline/histfile.c
+++ b/lib/readline/histfile.c
@@ -256,7 +256,11 @@ read_history_range (filename, from, to)
for (line_end = line_start; line_end < bufend; line_end++)
if (*line_end == '\n')
{
- *line_end = '\0';
+ /* Change to allow Windows-like \r\n end of line delimiter. */
+ if (line_end > line_start && line_end[-1] == '\r')
+ line_end[-1] = '\0';
+ else
+ *line_end = '\0';
if (*line_start)
{