diff --git a/TelegramUI/CreatePollOptionItem.swift b/TelegramUI/CreatePollOptionItem.swift index ca0ac71895..33204bf35a 100644 --- a/TelegramUI/CreatePollOptionItem.swift +++ b/TelegramUI/CreatePollOptionItem.swift @@ -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 { diff --git a/TelegramUI/ItemListControllerNode.swift b/TelegramUI/ItemListControllerNode.swift index bb6ee48840..c145c25dcc 100644 --- a/TelegramUI/ItemListControllerNode.swift +++ b/TelegramUI/ItemListControllerNode.swift @@ -419,9 +419,7 @@ class ItemListControllerNode: ASDisplayNode, UIScrollV } } } - if applied { - strongSelf.appliedFocusItemTag = focusItemTag - } + strongSelf.appliedFocusItemTag = focusItemTag } }