Skip to content

Commit

Permalink
Bit more redrawing
Browse files Browse the repository at this point in the history
Contributes to #99
  • Loading branch information
mchakravarty committed Feb 12, 2024
1 parent dd2a4cc commit 8f9dfc7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/CodeEditorView/CodeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ final class CodeView: UITextView {
textDidChangeObserver
= NotificationCenter.default.addObserver(forName: UITextView.textDidChangeNotification,
object: self,
queue: .main){ [weak self, minimapView] _ in
queue: .main){ [weak self, minimapView, codeStorageDelegate] _ in

self?.removeMessageViews(withIDs: self!.codeStorageDelegate.lastEvictedMessageIDs)
self?.gutterView?.invalidateGutter()
Expand All @@ -237,6 +237,14 @@ final class CodeView: UITextView {
// See [Note Minimap Redraw Voodoo]
minimapView.textLayoutManager?.ensureLayout(for: minimapView.textLayoutManager!.documentRange)
minimapView.textLayoutManager?.invalidateLayout(for: minimapView.textLayoutManager!.documentRange)
#elseif os(iOS)
// This doesn't seem to help on visionOS.
if (codeStorageDelegate.tokenInvalidationRange?.length ?? 0) > 1 {
Task { @MainActor in
minimapView.setNeedsLayout()
minimapView.setNeedsDisplay(minimapView.bounds)
}
}
#endif
}
}
Expand Down

0 comments on commit 8f9dfc7

Please sign in to comment.