From be84d3ad80e4b7957daff85c195693f71c8658c7 Mon Sep 17 00:00:00 2001 From: jahorton Date: Fri, 1 Mar 2024 10:27:16 +0700 Subject: [PATCH] fix(ios): cross-paragraph keyboard rules --- .../KeymanEngine/Classes/Keyboard/InputViewController.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift index 14514f62941..20f912c96eb 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Keyboard/InputViewController.swift @@ -389,7 +389,7 @@ open class InputViewController: UIInputViewController, KeymanWebDelegate { textDocumentProxy.deleteBackward() let newContext = textDocumentProxy.documentContextBeforeInput ?? "" let unitsDeleted = oldContext.utf16.count - newContext.utf16.count - let unitsInPoint = InputViewController.isSurrogate(oldContext.utf16.last!) ? 2 : 1 + let unitsInPoint = InputViewController.isSurrogate(oldContext.utf16.last ?? 0) ? 2 : 1 // This CAN happen when a surrogate pair is deleted. // For example, the emoji 👍🏻 is made of TWO surrogate pairs. @@ -416,7 +416,6 @@ open class InputViewController: UIInputViewController, KeymanWebDelegate { os_log("Failed to swallow a recent textDidChange call!", log: KeymanEngineLogger.ui, type: .default) } self.swallowBackspaceTextChange = true - break } }