From d806e9376dedec45e6227923f0a3a1dfc601191b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 26 Feb 2024 18:03:47 +0100 Subject: [PATCH] (Android) Fixed an issue where pressing the backspace key twice while editing text using a physical keyboard would close the text input dialog --- es-core/src/components/TextEditComponent.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/es-core/src/components/TextEditComponent.cpp b/es-core/src/components/TextEditComponent.cpp index 87475188b..506d0e2a5 100644 --- a/es-core/src/components/TextEditComponent.cpp +++ b/es-core/src/components/TextEditComponent.cpp @@ -10,6 +10,10 @@ #include "utils/StringUtil.h" +#if defined(__ANDROID__) +#include "Settings.h" +#endif + #define TEXT_PADDING_HORIZ 12.0f #define TEXT_PADDING_VERT 2.0f @@ -205,13 +209,21 @@ bool TextEditComponent::input(InputConfig* config, Input input) } return true; } -#if !defined(__ANDROID__) +#if defined(__ANDROID__) + else if (!Settings::getInstance()->getBool("VirtualKeyboard") && + input.id == SDLK_BACKSPACE) { + return false; + } + else if (Settings::getInstance()->getBool("VirtualKeyboard") && + input.id == SDLK_BACKSPACE) { + mMaskInput = false; +#else else if (input.id == SDLK_BACKSPACE) { mMaskInput = false; textInput("\b"); +#endif return true; } -#endif } if (cursorLeft || cursorRight) {