summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2013-03-31 19:32:49 +0000
committerSimon Howard2013-03-31 19:32:49 +0000
commitdaa0897ec9709b67da8a42ec5434c936d2f83506 (patch)
tree900bdf9908fe32b23bf65196460540ea4d7fbac7
parent9963de836f199c57b327b482b838d1e0b1e2bf91 (diff)
downloadchocolate-doom-daa0897ec9709b67da8a42ec5434c936d2f83506.tar.gz
chocolate-doom-daa0897ec9709b67da8a42ec5434c936d2f83506.tar.bz2
chocolate-doom-daa0897ec9709b67da8a42ec5434c936d2f83506.zip
Allow backspace or delete to clear the contents of an input box.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2574
-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;
}