Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ctrl-t implemented

  • Loading branch information...
commit 9c21ea236fd3cb5391fcf53335ae6895fc98640d 1 parent c56aa8d
@antirez authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 linenoise.c
View
9 linenoise.c
@@ -225,6 +225,15 @@ static int linenoisePrompt(int fd, char *buf, size_t buflen, const char *prompt)
refreshLine(fd,prompt,buf,len,pos,cols);
}
break;
+ case 20: /* ctrl-t */
+ if (pos > 0 && pos < len) {
+ int aux = buf[pos-1];
+ buf[pos-1] = buf[pos];
+ buf[pos] = aux;
+ if (pos != len-1) pos++;
+ refreshLine(fd,prompt,buf,len,pos,cols);
+ }
+ break;
case 2: /* ctrl-b */
goto left_arrow;
case 6: /* ctrl-f */
Please sign in to comment.
Something went wrong with that request. Please try again.