Commit 3258af5ac93b03714e9cd8c264e7b1dabb3f8617

Paul Chavent 2014-01-15T22:52:18

fix linenoiseEdit buflen decreasing.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/linenoise.c b/linenoise.c
index c4e3118..092e9ca 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -593,8 +593,8 @@ static int linenoiseEdit(int fd, char *buf, size_t buflen, const char *prompt)
     l.history_index = 0;
 
     /* Buffer starts empty. */
-    buf[0] = '\0';
-    buflen--; /* Make sure there is always space for the nulterm */
+    l.buf[0] = '\0';
+    l.buflen--; /* Make sure there is always space for the nulterm */
 
     /* The latest history entry is always our current buffer, that
      * initially is just an empty string. */