File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Sources/CodeEditTextView/TextLayoutManager Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ extension TextLayoutManager {
6262 /// - Warning: This is probably not what you're looking for. If you need to invalidate layout, or update lines, this
6363 /// is not the way to do so. This should only be called when macOS performs layout.
6464 public func layoutLines( in rect: NSRect ? = nil ) { // swiftlint:disable:this function_body_length
65- layoutLock. lock ( )
6665 guard let visibleRect = rect ?? delegate? . visibleRect,
6766 !isInTransaction,
6867 let textStorage else {
@@ -73,6 +72,7 @@ extension TextLayoutManager {
7372 // tree modifications caused by this method are atomic, so macOS won't call `layout` while we're already doing
7473 // that
7574 CATransaction . begin ( )
75+ layoutLock. lock ( )
7676
7777 let minY = max ( visibleRect. minY - verticalLayoutPadding, 0 )
7878 let maxY = max ( visibleRect. maxY + verticalLayoutPadding, 0 )
@@ -133,6 +133,7 @@ extension TextLayoutManager {
133133 needsLayout = false
134134
135135 // Commit the view tree changes we just made.
136+ layoutLock. unlock ( )
136137 CATransaction . commit ( )
137138
138139 if maxFoundLineWidth > maxLineWidth {
@@ -146,7 +147,6 @@ extension TextLayoutManager {
146147 if originalHeight != lineStorage. height || layoutView? . frame. size. height != lineStorage. height {
147148 delegate? . layoutManagerHeightDidUpdate ( newHeight: lineStorage. height)
148149 }
149- layoutLock. unlock ( )
150150 }
151151
152152 // MARK: - Layout Single Line
You can’t perform that action at this time.
0 commit comments