@@ -113,7 +113,6 @@ - (instancetype)initWithEditor:(IDESourceCodeEditor *)editor
113
113
self.editor = editor;
114
114
115
115
self.editorTextView = editor.textView ;
116
- [self .editorTextView.foldingManager setDelegate: self ];
117
116
118
117
[self setWantsLayer: YES ];
119
118
[self setAutoresizingMask: NSViewMinXMargin | NSViewMinYMargin | NSViewWidthSizable | NSViewHeightSizable];
@@ -132,7 +131,15 @@ - (instancetype)initWithEditor:(IDESourceCodeEditor *)editor
132
131
[self addSubview: self .scrollView];
133
132
134
133
self.textView = [[DVTSourceTextView alloc ] init ];
135
- [self .textView setTextStorage: self .editorTextView.textStorage];
134
+
135
+ // The editor's layout manager needs to be the last one, otherwise live issues don't work
136
+ NSTextStorage *storage = self.editorTextView .textStorage ;
137
+ [storage removeLayoutManager: self .editorTextView.layoutManager];
138
+ [storage addLayoutManager: self .textView.layoutManager];
139
+ [storage addLayoutManager: self .editorTextView.layoutManager];
140
+
141
+ [self .editorTextView.foldingManager setDelegate: self ];
142
+
136
143
[self .textView setEditable: NO ];
137
144
[self .textView setSelectable: NO ];
138
145
@@ -336,7 +343,8 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didFoldRange:(NSRange
336
343
337
344
[self .textView.foldingManager foldRange: range];
338
345
339
- [self invalidateLayoutForVisibleMinimapRange ];
346
+ [self .textView.layoutManager ensureLayoutForTextContainer: self .textView.textContainer];
347
+ [self updateOffset ];
340
348
}
341
349
342
350
- (void )foldingManager : (DVTFoldingManager *)foldingManager didUnfoldRange : (NSRange )range
@@ -345,7 +353,8 @@ - (void)foldingManager:(DVTFoldingManager *)foldingManager didUnfoldRange:(NSRan
345
353
346
354
[self .textView.foldingManager unfoldRange: range];
347
355
348
- [self invalidateLayoutForVisibleMinimapRange ];
356
+ [self .textView.layoutManager ensureLayoutForTextContainer: self .textView.textContainer];
357
+ [self updateOffset ];
349
358
}
350
359
351
360
#pragma mark - DBGBreakpointAnnotationProviderDelegate
@@ -576,10 +585,4 @@ - (void)invalidateDisplayForVisibleRange
576
585
[self .editorTextView.layoutManager invalidateDisplayForCharacterRange: visibleEditorRange];
577
586
}
578
587
579
- - (void )invalidateLayoutForVisibleMinimapRange
580
- {
581
- NSRange visibleMinimapRange = [self .textView visibleCharacterRange ];
582
- [self .textView.layoutManager invalidateLayoutForCharacterRange: visibleMinimapRange actualCharacterRange: nil ];
583
- }
584
-
585
588
@end
0 commit comments