summaryrefslogtreecommitdiff
path: root/histfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'histfile.c')
-rw-r--r--histfile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/histfile.c b/histfile.c
index 717bbee..2f051a3 100644
--- a/histfile.c
+++ b/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)
{