From b9ba20a3993f389dc54ca8d0fc6f8509833764aa Mon Sep 17 00:00:00 2001 From: Sam Parkinson Date: Sat, 5 Dec 2015 06:56:39 +1100 Subject: [PATCH] Implement CTRL-Backspace shortcut for clearing inputs, fixes #2355 --- src/platform/shared.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/platform/shared.c b/src/platform/shared.c index bc92131204..eec4829508 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -517,6 +517,17 @@ void platform_process_messages() // Text input + // Clear the input on 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;