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 {
13
13
}
14
14
15
15
public func estimatedWidth( ) -> CGFloat {
16
- maxLineWidth
16
+ maxLineWidth + edgeInsets . horizontal
17
17
}
18
18
19
19
/// 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 {
266
266
// Update the visible lines with the new set.
267
267
visibleLineIds = newVisibleLines
268
268
269
- if originalHeight != lineStorage. height || layoutView? . frame. size. height != lineStorage. height {
270
- delegate? . layoutManagerHeightDidUpdate ( newHeight: lineStorage. height)
271
- }
272
-
273
269
if maxFoundLineWidth > maxLineWidth {
274
270
maxLineWidth = maxFoundLineWidth
275
271
}
@@ -282,6 +278,11 @@ public class TextLayoutManager: NSObject {
282
278
isInLayout = false
283
279
#endif
284
280
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
+ }
285
286
}
286
287
287
288
/// Lays out a single text line.
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ extension TextView {
83
83
if didUpdate {
84
84
needsLayout = true
85
85
needsDisplay = true
86
- layoutManager. layoutLines ( )
86
+ layoutManager. setNeedsLayout ( )
87
87
}
88
88
89
89
if isSelectable {
You can’t perform that action at this time.
0 commit comments