Skip to content

Commit

Permalink
Revert "Mutate view hierarchy only on annotations count change"
Browse files Browse the repository at this point in the history
This reverts commit 89555f8.
  • Loading branch information
krzyzanowskim committed Dec 28, 2023
1 parent 89555f8 commit 94b6c97
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions Sources/AnnotationsPlugin/AnnotationsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ extension AnnotationsPlugin {
guard let dataSource = parent.dataSource else {
return
}

let annotations = dataSource.textViewAnnotations()
guard annotations.count != annotationsViews.count else {
return
}

// Remove all views
for view in annotationsViews {
Expand All @@ -97,7 +92,7 @@ extension AnnotationsPlugin {

// Add views for annotations
let textLayoutManager = context.textView.textLayoutManager
for annotation in annotations {
for annotation in dataSource.textViewAnnotations() {
textLayoutManager.ensureLayout(for: NSTextRange(location: annotation.location))
if let textLineFragment = textLayoutManager.textLineFragment(at: annotation.location) {
if let annotationView = dataSource.textView(context.textView, viewForLineAnnotation: annotation, textLineFragment: textLineFragment) {
Expand Down

0 comments on commit 94b6c97

Please sign in to comment.