fix masking input when there is no hintsCallback

Signed-off-by: lifubang <lifubang@acmcoder.com>
This commit is contained in:
lifubang
2020-03-03 08:35:19 +08:00
parent 4261898b11
commit ec5e4e8716

View File

@@ -669,7 +669,8 @@ int linenoiseEditInsert(struct linenoiseState *l, char c) {
if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) { if ((!mlmode && l->plen+l->len < l->cols && !hintsCallback)) {
/* Avoid a full update of the line in the /* Avoid a full update of the line in the
* trivial case. */ * trivial case. */
if (write(l->ofd,&c,1) == -1) return -1; char d = (maskmode==1) ? '*' : c;
if (write(l->ofd,&d,1) == -1) return -1;
} else { } else {
refreshLine(l); refreshLine(l);
} }