The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: victor_18993 on July 17, 2026, 01:18:57 AM

Title: Android Back key is incorrectly mapped to Delete
Post by: victor_18993 on July 17, 2026, 01:18:57 AM
The Android Back key is currently mapped to
SIM_KEYCODE_DELETE in the SDL2 backend.
This normally goes unnoticed because both Escape and Delete close the top window when the event is not consumed first. However, a text input consumes Delete and removes the character under the cursor.
As a result, pressing Android Back while editing text deletes a character instead of following the existing Escape behaviour.
The attached patch maps
SDLK_AC_BACK to
SIM_KEYCODE_ESCAPE, while leaving the real Delete key unchanged.
The functional change is only:
- case SDLK_ESCAPE:     code = SIM_KEYCODE_ESCAPE;                break;
- case SDLK_AC_BACK:
+ case SDLK_AC_BACK:
+ case SDLK_ESCAPE:     code = SIM_KEYCODE_ESCAPE;                break;
  case SDLK_DELETE:     code = SIM_KEYCODE_DELETE;                break;

I checked the complete event path:
Validation:
I could not test the result on a physical Android device or a working emulator, so Android runtime testing remains pending.
Patch attached.
Title: Re: Android Back key is incorrectly mapped to Delete
Post by: prissi on July 19, 2026, 07:46:29 AM
Delete closes all windows though. But maybe only closing the top window is even a better choice.