Commit 9ead4f9 1 parent 83aa14f commit 9ead4f9 Copy full SHA for 9ead4f9
File tree 2 files changed +8
-6
lines changed
2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -403,12 +403,14 @@ import AVFoundation
403
403
/// The manager that lays out text for the text view's text container.
404
404
@objc dynamic open var textLayoutManager : NSTextLayoutManager {
405
405
willSet {
406
+ textContentManager. primaryTextLayoutManager = nil
406
407
textContentManager. removeTextLayoutManager ( newValue)
407
408
}
408
409
didSet {
409
410
textContentManager. addTextLayoutManager ( textLayoutManager)
410
411
textContentManager. primaryTextLayoutManager = textLayoutManager
411
412
setupTextLayoutManager ( textLayoutManager)
413
+ self . text = text
412
414
}
413
415
}
414
416
@@ -612,8 +614,6 @@ import AVFoundation
612
614
613
615
super. init ( frame: frameRect)
614
616
615
- setupTextLayoutManager ( textLayoutManager)
616
-
617
617
textFinderBarContainer. client = self
618
618
textFinder. findBarContainer = textFinderBarContainer
619
619
@@ -636,6 +636,7 @@ import AVFoundation
636
636
addGestureRecognizer ( recognizer)
637
637
}
638
638
639
+ setupTextLayoutManager ( textLayoutManager)
639
640
setSelectedTextRange ( NSTextRange ( location: textLayoutManager. documentRange. location) , updateLayout: false )
640
641
}
641
642
Original file line number Diff line number Diff line change @@ -36,12 +36,14 @@ import STTextViewCommon
36
36
/// The manager that lays out text for the text view's text container.
37
37
@objc dynamic open var textLayoutManager : NSTextLayoutManager {
38
38
willSet {
39
+ textContentManager. primaryTextLayoutManager = nil
39
40
textContentManager. removeTextLayoutManager ( newValue)
40
41
}
41
42
didSet {
42
43
textContentManager. addTextLayoutManager ( textLayoutManager)
43
44
textContentManager. primaryTextLayoutManager = textLayoutManager
44
45
setupTextLayoutManager ( textLayoutManager)
46
+ self . text = text
45
47
}
46
48
}
47
49
@@ -444,13 +446,9 @@ import STTextViewCommon
444
446
445
447
super. init ( frame: frame)
446
448
447
- setupTextLayoutManager ( textLayoutManager)
448
-
449
449
contentView. clipsToBounds = clipsToBounds
450
450
lineHighlightView. clipsToBounds = clipsToBounds
451
451
452
- setSelectedTextRange ( NSTextRange ( location: textLayoutManager. documentRange. location) , updateLayout: false )
453
-
454
452
addSubview ( contentView)
455
453
contentView. addSubview ( lineHighlightView)
456
454
@@ -462,6 +460,9 @@ import STTextViewCommon
462
460
463
461
updateEditableInteraction ( )
464
462
isGutterVisible = showsLineNumbers
463
+
464
+ setupTextLayoutManager ( textLayoutManager)
465
+ setSelectedTextRange ( NSTextRange ( location: textLayoutManager. documentRange. location) , updateLayout: false )
465
466
}
466
467
467
468
@available ( * , unavailable)
You can’t perform that action at this time.
0 commit comments