diff mbox series

[4/5] ui/ncurses: Implement non-boot-cancelling keys

Message ID 20180703063447.8338-5-jk@ozlabs.org
State Accepted
Headers show
Series Implement a set of hotkeys for temporary autoboot override | expand

Commit Message

Jeremy Kerr July 3, 2018, 6:34 a.m. UTC
Allow some keys to not cancel the default-boot process.

For the moment, this is just the screen refresh (ctrl+L).

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 ui/ncurses/nc-cui.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 8a3f97d..87540ca 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -527,6 +527,14 @@  struct nc_scr *cui_set_current(struct cui *cui, struct nc_scr *scr)
 	return old;
 }
 
+static bool key_cancels_boot(int key)
+{
+	if (key == 0xc)
+		return false;
+
+	return true;
+}
+
 static bool process_global_keys(struct cui *cui, int key)
 {
 	switch (key) {
@@ -582,7 +590,7 @@  static int cui_process_key(void *arg)
 			}
 		}
 
-		if (!cui->has_input) {
+		if (!cui->has_input && key_cancels_boot(c)) {
 			cui->has_input = true;
 			if (cui->client) {
 				pb_log("UI input received (key = %d), aborting "