summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-16 06:20:03 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-16 06:20:03 -0700
commit3733d13790f3ec3da3f1396d01f57d08710982f9 (patch)
tree035f85e9517068129a0f4d8f057d1eda01b2f169 /linenoise
parent171a3adbcf495b75b06b96587ceed770f6e2af3e (diff)
downloadtxr-3733d13790f3ec3da3f1396d01f57d08710982f9.tar.gz
txr-3733d13790f3ec3da3f1396d01f57d08710982f9.tar.bz2
txr-3733d13790f3ec3da3f1396d01f57d08710982f9.zip
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.
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c5
1 files changed, 1 insertions, 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);
}