SDL: Fixed double-backspace with hardware keyboard on iOS (259e4)

From 259e4fe1a2aaec6cffb8644a2fb07b472443f571 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 27 Apr 2026 10:18:25 -0700
Subject: [PATCH] Fixed double-backspace with hardware keyboard on iOS

(cherry picked from commit b7726026f8fd9d5bf3c39a8566162db23f755e7d)
---
 src/video/uikit/SDL_uikitviewcontroller.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/video/uikit/SDL_uikitviewcontroller.m b/src/video/uikit/SDL_uikitviewcontroller.m
index bbb49f835a441..e9b48c2e0110d 100644
--- a/src/video/uikit/SDL_uikitviewcontroller.m
+++ b/src/video/uikit/SDL_uikitviewcontroller.m
@@ -581,7 +581,7 @@ - (void)textFieldTextDidChange:(NSNotification *)notification
                 break;
             }
         }
-        if (matchLength < committedText.length) {
+        if (matchLength < committedText.length && !SDL_HasKeyboard()) {
             size_t deleteLength = SDL_utf8strlen([[committedText substringFromIndex:matchLength] UTF8String]);
             while (deleteLength > 0) {
                 // Send distinct down and up events for each backspace action