Permalink
Browse files

ctrl-t implemented

  • Loading branch information...
1 parent c56aa8d commit 9c21ea236fd3cb5391fcf53335ae6895fc98640d @antirez committed Mar 22, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 linenoise.c
View
@@ -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 */

0 comments on commit 9c21ea2

Please sign in to comment.