]> git.lizzy.rs Git - linenoise.git/commitdiff
Ctrl+K support
authorantirez <antirez@gmail.com>
Sun, 21 Mar 2010 10:03:33 +0000 (11:03 +0100)
committerantirez <antirez@gmail.com>
Sun, 21 Mar 2010 10:03:33 +0000 (11:03 +0100)
linenoise.c

index f2760eb3397032cead670680eea158e60bbd9a0a..2a6bff98340457e8a2fc6df68a91986c525fd7c0 100644 (file)
@@ -259,6 +259,11 @@ static int linenoisePrompt(int fd, char *buf, size_t buflen, char *prompt) {
                 }
             }
             break;
+        case 11: /* Ctrl+K, delete from current to end of line. */
+            buf[pos] = '\0';
+            len = pos;
+            refreshLine(fd,prompt,buf,len,pos,cols);
+            break;
         }
     }
     return len;