Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show original buffer when completion is aborted

  • Loading branch information...
commit 778de19a2bd850e57db50b44572118bd2c9403f0 1 parent 493a550
Pieter Noordhuis pietern authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 linenoise.c
6 linenoise.c
View
@@ -243,10 +243,14 @@ static int completeLine(int fd, const char *prompt, char *buf, size_t buflen, si
if (i == lc.len) beep();
break;
case 27: /* escape */
+ /* Re-show original buffer */
+ if (i < lc.len) {
+ refreshLine(fd,prompt,buf,*len,*pos,cols);
+ }
stop = 1;
break;
default:
- /* update buffer and return */
+ /* Update buffer and return */
if (i < lc.len) {
nwritten = snprintf(buf,buflen,"%s",lc.cvec[i]);
*len = *pos = nwritten;
Please sign in to comment.
Something went wrong with that request. Please try again.