]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[readline] Accept Ctrl-U for "delete to start of line"
authorRobin Smidsrød <robin@smidsrod.no>
Wed, 28 Mar 2012 10:52:55 +0000 (11:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 28 Mar 2012 10:52:55 +0000 (11:52 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/hci/editstring.c

index 996528ff563a07d057c03b66dfbdaa0923ada6ed..35a5b2c1841e68764b2bb8a758a3807b6a0dc5fa 100644 (file)
@@ -36,6 +36,7 @@ static void insert_character ( struct edit_string *string,
                                unsigned int character ) __nonnull;
 static void delete_character ( struct edit_string *string ) __nonnull;
 static void backspace ( struct edit_string *string ) __nonnull;
+static void kill_sol ( struct edit_string *string ) __nonnull;
 static void kill_eol ( struct edit_string *string ) __nonnull;
 
 /**
@@ -108,6 +109,17 @@ static void backspace ( struct edit_string *string ) {
        }
 }
 
+/**
+ * Delete to start of line
+ *
+ * @v string           Editable string
+ */
+static void kill_sol ( struct edit_string *string ) {
+       size_t old_cursor = string->cursor;
+       string->cursor = 0;
+       insert_delete ( string, old_cursor, NULL );
+}
+
 /**
  * Delete to end of line
  *
@@ -168,6 +180,10 @@ int edit_string ( struct edit_string *string, int key ) {
                /* Delete character */
                delete_character ( string );
                break;
+       case CTRL_U:
+               /* Delete to start of line */
+               kill_sol ( string );
+               break;
        case CTRL_K:
                /* Delete to end of line */
                kill_eol ( string );