Skip to content

Commit

Permalink
ctrl-t implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Mar 22, 2010
1 parent c56aa8d commit 9c21ea2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions linenoise.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 9c21ea2

Please sign in to comment.