Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[readline] Accept Ctrl-U for "delete to start of line"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
robinsmidsrod authored and mcb30 committed Mar 28, 2012
1 parent b9720e4 commit aac9718
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/hci/editstring.c
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
*
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit aac9718

Please sign in to comment.