Allow backspace or delete to clear the contents of an input box.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 2574
This commit is contained in:
Simon Howard 2013-03-31 19:32:49 +00:00
parent 9963de836f
commit daa0897ec9

View file

@ -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;
}