From b12f6ba9cbcb311ba1aecccde692a4ab9faa4bc4 Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Thu, 15 Feb 2018 22:38:41 -0600 Subject: [PATCH] Set seq to empty string if color/bold not used Otherwise the subsequent abAppend will concatenate whatever junk data is in seq to ab --- linenoise.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linenoise.c b/linenoise.c index fce14a7c..10ffd71c 100644 --- a/linenoise.c +++ b/linenoise.c @@ -485,6 +485,8 @@ void refreshShowHints(struct abuf *ab, struct linenoiseState *l, int plen) { if (bold == 1 && color == -1) color = 37; if (color != -1 || bold != 0) snprintf(seq,64,"\033[%d;%d;49m",bold,color); + else + seq[0] = '\0'; abAppend(ab,seq,strlen(seq)); abAppend(ab,hint,hintlen); if (color != -1 || bold != 0)