File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ extension TextLayoutManager {
1313 }
1414
1515 public func estimatedWidth( ) -> CGFloat {
16- maxLineWidth
16+ maxLineWidth + edgeInsets . horizontal
1717 }
1818
1919 /// Finds a text line for the given y position relative to the text view.
Original file line number Diff line number Diff line change @@ -266,10 +266,6 @@ public class TextLayoutManager: NSObject {
266266 // Update the visible lines with the new set.
267267 visibleLineIds = newVisibleLines
268268
269- if originalHeight != lineStorage. height || layoutView? . frame. size. height != lineStorage. height {
270- delegate? . layoutManagerHeightDidUpdate ( newHeight: lineStorage. height)
271- }
272-
273269 if maxFoundLineWidth > maxLineWidth {
274270 maxLineWidth = maxFoundLineWidth
275271 }
@@ -282,6 +278,11 @@ public class TextLayoutManager: NSObject {
282278 isInLayout = false
283279 #endif
284280 needsLayout = false
281+
282+ // This needs to happen after ``needsLayout`` is toggled. Things can be triggered by frame changes.
283+ if originalHeight != lineStorage. height || layoutView? . frame. size. height != lineStorage. height {
284+ delegate? . layoutManagerHeightDidUpdate ( newHeight: lineStorage. height)
285+ }
285286 }
286287
287288 /// Lays out a single text line.
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ extension TextView {
8383 if didUpdate {
8484 needsLayout = true
8585 needsDisplay = true
86- layoutManager. layoutLines ( )
86+ layoutManager. setNeedsLayout ( )
8787 }
8888
8989 if isSelectable {
You can’t perform that action at this time.
0 commit comments