Implement CTRL-Backspace shortcut for clearing inputs, fixes #2355

This commit is contained in:
Sam Parkinson 2015-12-05 06:56:39 +11:00
parent 8d971d3e0e
commit b9ba20a399
1 changed files with 11 additions and 0 deletions

View File

@ -517,6 +517,17 @@ void platform_process_messages()
// Text input
// Clear the input on <CTRL>Backspace
if (gTextInput != NULL
&& e.key.keysym.sym == SDLK_BACKSPACE
&& e.key.keysym.mod & KMOD_CTRL) {
memset(gTextInput, '\0', gTextInputMaxLength);
gTextInputCursorPosition = 0;
gTextInputLength = 0;
console_refresh_caret();
window_update_textbox();
}
// If backspace and we have input text with a cursor position none zero
if (e.key.keysym.sym == SDLK_BACKSPACE && gTextInputLength > 0 && gTextInput != NULL && gTextInputCursorPosition) {
int dstIndex = gTextInputCursorPosition;