diff options
author | Robin Smidsrød | 2012-03-28 12:52:55 +0200 |
---|---|---|
committer | Michael Brown | 2012-03-28 12:52:55 +0200 |
commit | aac9718fd60e5a85579ffc3d63c302615c403b03 (patch) | |
tree | 721c3ee590c8f06bf9b826f4352e5cab2e972b2a /src/hci | |
parent | [http] Disambiguate the various error causes (diff) | |
download | ipxe-aac9718fd60e5a85579ffc3d63c302615c403b03.tar.gz ipxe-aac9718fd60e5a85579ffc3d63c302615c403b03.tar.xz ipxe-aac9718fd60e5a85579ffc3d63c302615c403b03.zip |
[readline] Accept Ctrl-U for "delete to start of line"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/hci')
-rw-r--r-- | src/hci/editstring.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hci/editstring.c b/src/hci/editstring.c index 996528ff..35a5b2c1 100644 --- a/src/hci/editstring.c +++ b/src/hci/editstring.c @@ -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; /** @@ -109,6 +110,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 * * @v string Editable string @@ -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 ); |