summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-04-13 12:34:14 +0200
committerantirez <antirez@gmail.com>2016-04-13 12:34:14 +0200
commitd1ddf7e9585eea836a47847602f7b05038856a49 (patch)
tree0048bdbc4f98ade010e22d861363d95b2373dea0 /deps
parentd6e2cc71c6072b013cbca6dd6ee5cdd55620a70d (diff)
downloadredis-d1ddf7e9585eea836a47847602f7b05038856a49.tar.gz
redis-cli hints.
Diffstat (limited to 'deps')
-rw-r--r--deps/linenoise/linenoise.c8
-rw-r--r--deps/linenoise/linenoise.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/deps/linenoise/linenoise.c b/deps/linenoise/linenoise.c
index 368cd05c7..a807d9b8a 100644
--- a/deps/linenoise/linenoise.c
+++ b/deps/linenoise/linenoise.c
@@ -815,6 +815,14 @@ static int linenoiseEdit(int stdin_fd, int stdout_fd, char *buf, size_t buflen,
history_len--;
free(history[history_len]);
if (mlmode) linenoiseEditMoveEnd(&l);
+ if (hintsCallback) {
+ /* Force a refresh without hints to leave the previous
+ * line as the user typed it after a newline. */
+ linenoiseHintsCallback *hc = hintsCallback;
+ hintsCallback = NULL;
+ refreshLine(&l);
+ hintsCallback = hc;
+ }
return (int)l.len;
case CTRL_C: /* ctrl-c */
errno = EAGAIN;
diff --git a/deps/linenoise/linenoise.h b/deps/linenoise/linenoise.h
index 3138c1f20..ed20232c5 100644
--- a/deps/linenoise/linenoise.h
+++ b/deps/linenoise/linenoise.h
@@ -50,7 +50,7 @@ typedef struct linenoiseCompletions {
typedef void(linenoiseCompletionCallback)(const char *, linenoiseCompletions *);
typedef char*(linenoiseHintsCallback)(const char *, int *color, int *bold);
-typedef char*(linenoiseFreeHintsCallback)(char *);
+typedef void(linenoiseFreeHintsCallback)(void *);
void linenoiseSetCompletionCallback(linenoiseCompletionCallback *);
void linenoiseSetHintsCallback(linenoiseHintsCallback *);
void linenoiseSetFreeHintsCallback(linenoiseFreeHintsCallback *);