* histfile.c (read_history_range): Remove '\r' character from
authorDaniel Jacobowitz <drow@false.org>
Tue, 21 Mar 2006 14:58:24 +0000 (14:58 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 21 Mar 2006 14:58:24 +0000 (14:58 +0000)
history lines.

readline/ChangeLog.gdb
readline/histfile.c

index 28cb1f2ff359652e58b435ac07a77f5b2a7040ea..863beca4441a2869280de45b1a2a5e12bddfd9a3 100644 (file)
@@ -1,3 +1,8 @@
+2006-03-21  Denis Pilat  <denis.pilat@st.com>
+
+       * histfile.c (read_history_range): Remove '\r' character from
+       history lines.
+
 2005-02-10  Denis Pilat  <denis.pilat@st.com>
 
        * readline/terminal.c (_rl_get_screen_size): Get console size from
index 60a91251b7aec1a754ce02ca0623e7bde4c6b8fb..c19630dc8f3907ea57031382b1122f88fb2f7cf4 100644 (file)
@@ -228,7 +228,10 @@ read_history_range (filename, from, to)
   for (line_end = line_start; line_end < bufend; line_end++)
     if (*line_end == '\n')
       {
-       *line_end = '\0';
+       if (line_end - 1 >= line_start && *(line_end - 1) == '\r')
+         *(line_end - 1) = '\0';
+       else
+         *line_end = '\0';
 
        if (*line_start)
          add_history (line_start);