Browse Source

[readline] Accept Ctrl-U for "delete to start of line"

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Robin Smidsrød 12 years ago
parent
commit
aac9718fd6
1 changed files with 16 additions and 0 deletions
  1. 16
    0
      src/hci/editstring.c

+ 16
- 0
src/hci/editstring.c View File

36
                                unsigned int character ) __nonnull;
36
                                unsigned int character ) __nonnull;
37
 static void delete_character ( struct edit_string *string ) __nonnull;
37
 static void delete_character ( struct edit_string *string ) __nonnull;
38
 static void backspace ( struct edit_string *string ) __nonnull;
38
 static void backspace ( struct edit_string *string ) __nonnull;
39
+static void kill_sol ( struct edit_string *string ) __nonnull;
39
 static void kill_eol ( struct edit_string *string ) __nonnull;
40
 static void kill_eol ( struct edit_string *string ) __nonnull;
40
 
41
 
41
 /**
42
 /**
108
 	}
109
 	}
109
 }
110
 }
110
 
111
 
112
+/**
113
+ * Delete to start of line
114
+ *
115
+ * @v string           Editable string
116
+ */
117
+static void kill_sol ( struct edit_string *string ) {
118
+	size_t old_cursor = string->cursor;
119
+	string->cursor = 0;
120
+	insert_delete ( string, old_cursor, NULL );
121
+}
122
+
111
 /**
123
 /**
112
  * Delete to end of line
124
  * Delete to end of line
113
  *
125
  *
168
 		/* Delete character */
180
 		/* Delete character */
169
 		delete_character ( string );
181
 		delete_character ( string );
170
 		break;
182
 		break;
183
+	case CTRL_U:
184
+		/* Delete to start of line */
185
+		kill_sol ( string );
186
+		break;
171
 	case CTRL_K:
187
 	case CTRL_K:
172
 		/* Delete to end of line */
188
 		/* Delete to end of line */
173
 		kill_eol ( string );
189
 		kill_eol ( string );

Loading…
Cancel
Save