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