mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Fix text entity generation when separating entities with slashes
This commit is contained in:
parent
af8c6c7e57
commit
a960811eac
1 changed files with 6 additions and 5 deletions
|
|
@ -22,12 +22,11 @@ private let identifierDelimiterSet: CharacterSet = {
|
|||
var set = CharacterSet.punctuationCharacters
|
||||
set.formUnion(CharacterSet.whitespacesAndNewlines)
|
||||
set.insert("|")
|
||||
set.insert("/")
|
||||
return set
|
||||
}()
|
||||
private let externalIdentifierDelimiterSet: CharacterSet = {
|
||||
var set = CharacterSet.punctuationCharacters
|
||||
set.formUnion(CharacterSet.whitespacesAndNewlines)
|
||||
set.insert("|")
|
||||
var set = identifierDelimiterSet
|
||||
set.remove(".")
|
||||
return set
|
||||
}()
|
||||
|
|
@ -196,8 +195,10 @@ public func generateTextEntities(_ text: String, enabledTypes: EnabledEntityType
|
|||
if let scalar = scalar {
|
||||
if scalar == "/" {
|
||||
notFound = false
|
||||
if previousScalar != nil && !delimiterSet.contains(previousScalar!) {
|
||||
currentEntity = nil
|
||||
if let previousScalar = previousScalar, !delimiterSet.contains(previousScalar) {
|
||||
if let entity = currentEntity, entity.0 == .command {
|
||||
currentEntity = nil
|
||||
}
|
||||
} else {
|
||||
if let (type, range) = currentEntity {
|
||||
commitEntity(utf16, type, range, enabledTypes, &entities)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue