summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-05-28 17:16:57 -0400
committerRay Strode <rstrode@redhat.com>2008-05-28 17:16:57 -0400
commit8f79086021c15fdec555d41ee1283506d74beccc (patch)
tree4d91a0bc49af26f162988ea498b01e5e25d0eebb
parent93ff1b78822b7855a58d3a7416f07f36eaa3b837 (diff)
downloadplymouth-8f79086021c15fdec555d41ee1283506d74beccc.tar.gz
plymouth-8f79086021c15fdec555d41ee1283506d74beccc.tar.xz
plymouth-8f79086021c15fdec555d41ee1283506d74beccc.zip
Add ctrl-u and ctrl-w to erase password line
Right now we do it in the cheesiest way possible, by calling the backspace function over and over again on behalf of the user. It might make more sense to export another window callback specifically for erase line. It probably doesn't make sense to do that until we fix the TODO item: - have plugins hook into line editing through window directly, instead of via vtable functions though.
-rw-r--r--src/ply-window.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ply-window.c b/src/ply-window.c
index 747fa3e..a3dc889 100644
--- a/src/ply-window.c
+++ b/src/ply-window.c
@@ -44,6 +44,8 @@
#include "ply-utils.h"
#define KEY_CTRL_T ('\100' ^'T')
+#define KEY_CTRL_U ('\100' ^'U')
+#define KEY_CTRL_W ('\100' ^'W')
#define KEY_CTRL_V ('\100' ^'V')
#define KEY_ESCAPE ('\100' ^'[')
#define KEY_RETURN '\r'
@@ -119,6 +121,15 @@ process_backspace (ply_window_t *window)
}
static void
+process_line_erase (ply_window_t *window)
+{
+ size_t size;
+
+ while ((size = ply_buffer_get_size (window->line_buffer)) > 0)
+ process_backspace (window);
+}
+
+static void
process_keyboard_input (ply_window_t *window,
const char *keyboard_input,
size_t character_size)
@@ -136,6 +147,12 @@ process_keyboard_input (ply_window_t *window,
ply_trace ("text mode toggled!");
return;
+ case KEY_CTRL_U:
+ case KEY_CTRL_W:
+ ply_trace ("erase line!");
+ process_line_erase (window);
+ return;
+
case KEY_CTRL_V:
ply_trace ("toggle verbose mode!");
ply_toggle_tracing ();