Skip to content

Commit

Permalink
fix(ios): cross-paragraph keyboard rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jahorton committed Mar 1, 2024
1 parent ec63f1d commit be84d3a
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
}

Expand Down

0 comments on commit be84d3a

Please sign in to comment.