From 3733d13790f3ec3da3f1396d01f57d08710982f9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 16 Sep 2015 06:20:03 -0700 Subject: linenoise: don't process carriage returns in history. * linenoise/linenoise.c (lino_hist_load): Don't look for and overwrite carriage returns with the null character; only do that for newlines. We already handle embedded carriage returns just fine by displaying them as ^M. There is a plan to use these characters for breaking up lines in an enhanced multi-line mode. --- linenoise/linenoise.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 5f952a7a..903410b0 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1507,10 +1507,7 @@ int lino_hist_load(lino_t *ls, const char *filename) { } while (fgets(buf,LINENOISE_MAX_LINE,fp) != NULL) { - char *p; - - p = strchr(buf,'\r'); - if (!p) p = strchr(buf,'\n'); + char *p = strchr(buf,'\n'); if (p) *p = '\0'; lino_hist_add(ls, buf); } -- cgit v1.2.3