summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--textscreen/txt_inputbox.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/textscreen/txt_inputbox.c b/textscreen/txt_inputbox.c
index da872c9c..13d35aef 100644
--- a/textscreen/txt_inputbox.c
+++ b/textscreen/txt_inputbox.c
@@ -216,6 +216,15 @@ static int TXT_InputBoxKeyPress(TXT_UNCAST_ARG(inputbox), int key)
return 1;
}
+ // Backspace or delete erases the contents of the box.
+
+ if ((key == KEY_DEL || key == KEY_BACKSPACE)
+ && inputbox->widget.widget_class == &txt_inputbox_class)
+ {
+ free(*((char **)inputbox->value));
+ *((char **) inputbox->value) = strdup("");
+ }
+
return 0;
}