Commit 4b9fe35867b1f5e131188552e302ae8918edccd4

antirez 2010-03-21T11:06:56

Support for Ctrl+u added

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/linenoise.c b/linenoise.c
index 2a6bff9..47ff562 100644
--- a/linenoise.c
+++ b/linenoise.c
@@ -259,6 +259,11 @@ static int linenoisePrompt(int fd, char *buf, size_t buflen, char *prompt) {
                 }
             }
             break;
+        case 21: /* Ctrl+U, delete the whole line. */
+            buf[0] = '\0';
+            pos = len = 0;
+            refreshLine(fd,prompt,buf,len,pos,cols);
+            break;
         case 11: /* Ctrl+K, delete from current to end of line. */
             buf[pos] = '\0';
             len = pos;