Fixes #2286 - Timeline entries flickering when a lot of mention pills present

This commit is contained in:
Stefan Ceriu
2024-01-03 17:27:18 +02:00
committed by Stefan Ceriu
parent 60ec0d8300
commit 075ff355cf
4 changed files with 15 additions and 6 deletions

View File

@@ -18,7 +18,12 @@ import Foundation
extension AttributedString {
var formattedComponents: [AttributedStringBuilderComponent] {
runs[\.blockquote].map { value, range in
var components = [AttributedStringBuilderComponent]()
for (index, run) in runs[\.blockquote].enumerated() {
let value = run.0
let range = run.1
var attributedString = AttributedString(self[range])
// Remove trailing new lines if any
@@ -29,8 +34,10 @@ extension AttributedString {
let isBlockquote = value != nil
return AttributedStringBuilderComponent(attributedString: attributedString, isBlockquote: isBlockquote)
components.append(AttributedStringBuilderComponent(id: index, attributedString: attributedString, isBlockquote: isBlockquote))
}
return components
}
/// Replaces the specified placeholder with a string that links to the specified URL.