mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-09 07:41:40 +00:00
Fix trailing space when entering poll options
This commit is contained in:
parent
59e2607e08
commit
ea4b62939b
@ -161,15 +161,17 @@ class CreatePollOptionItemNode: ItemListRevealOptionsItemNode, ItemListItemNode,
|
||||
return false
|
||||
}
|
||||
if text.firstIndex(of: "\n") != nil {
|
||||
let currentText = editableTextNode.attributedText?.string ?? ""
|
||||
var updatedText = (currentText as NSString).replacingCharacters(in: range, with: text)
|
||||
updatedText = updatedText.replacingOccurrences(of: "\n", with: " ")
|
||||
if updatedText.count == 1 {
|
||||
updatedText = ""
|
||||
if text != "\n" {
|
||||
let currentText = editableTextNode.attributedText?.string ?? ""
|
||||
var updatedText = (currentText as NSString).replacingCharacters(in: range, with: text)
|
||||
updatedText = updatedText.replacingOccurrences(of: "\n", with: " ")
|
||||
if updatedText.count == 1 {
|
||||
updatedText = ""
|
||||
}
|
||||
let updatedAttributedText = NSAttributedString(string: updatedText, font: Font.regular(17.0), textColor: item.theme.list.itemPrimaryTextColor)
|
||||
self.textNode.attributedText = updatedAttributedText
|
||||
self.editableTextNodeDidUpdateText(editableTextNode)
|
||||
}
|
||||
let updatedAttributedText = NSAttributedString(string: updatedText, font: Font.regular(17.0), textColor: item.theme.list.itemPrimaryTextColor)
|
||||
self.textNode.attributedText = updatedAttributedText
|
||||
self.editableTextNodeDidUpdateText(editableTextNode)
|
||||
if let next = item.next {
|
||||
next()
|
||||
} else {
|
||||
|
||||
@ -419,9 +419,7 @@ class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UIScrollV
|
||||
}
|
||||
}
|
||||
}
|
||||
if applied {
|
||||
strongSelf.appliedFocusItemTag = focusItemTag
|
||||
}
|
||||
strongSelf.appliedFocusItemTag = focusItemTag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user