@@ -27,7 +27,7 @@ - (id)initWithFrame:(NSRect)frame
2727 {
2828 /* Configure ScrollView */
2929 [self setWantsLayer: YES ];
30- [self setAutoresizingMask: NSViewMinXMargin | NSViewWidthSizable | NSViewHeightSizable];
30+ [self setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable];
3131 [self setDrawsBackground: NO ];
3232 [self setHorizontalScrollElasticity: NSScrollElasticityNone];
3333 [self setVerticalScrollElasticity: NSScrollElasticityNone];
@@ -62,14 +62,11 @@ - (NSTextView *)textView
6262{
6363 if (_textView == nil ) {
6464 _textView = [[NSTextView alloc ] initWithFrame: self .bounds];
65- [_textView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewWidthSizable | NSViewHeightSizable];
6665 [_textView setBackgroundColor: [NSColor clearColor ]];
6766
6867 [_textView.textContainer setLineFragmentPadding: 0 .0f ];
6968
7069 [_textView.layoutManager setDelegate: self ];
71- // [_textView.layoutManager setAllowsNonContiguousLayout:YES];
72- // [_textView.layoutManager setBackgroundLayoutEnabled:YES];
7370
7471 [_textView setAllowsUndo: NO ];
7572 [_textView setAllowsImageEditing: NO ];
@@ -147,10 +144,10 @@ - (NSColor *)backgroundColor
147144- (void )show
148145{
149146 self.hidden = NO ;
150-
151- NSRect editorTextViewFrame = self.editorTextView .frame ;
152- editorTextViewFrame.size .width = self.editorTextView .superview .frame .size .width - self.bounds .size .width - kRightSidePadding ;
153- self.editorTextView .frame = editorTextViewFrame;
147+
148+ NSRect editorTextViewFrame = self.editorScrollView .frame ;
149+ editorTextViewFrame.size .width = self.editorScrollView .superview .frame .size .width - self.bounds .size .width ;
150+ self.editorScrollView .frame = editorTextViewFrame;
154151
155152 [self updateTextView ];
156153 [self updateSelectionView ];
@@ -160,20 +157,20 @@ - (void)hide
160157{
161158 self.hidden = YES ;
162159
163- NSRect editorTextViewFrame = self.editorTextView .frame ;
164- editorTextViewFrame.size .width = self.editorTextView .superview .frame .size .width ;
165- self.editorTextView .frame = editorTextViewFrame;
160+ NSRect editorTextViewFrame = self.editorScrollView .frame ;
161+ editorTextViewFrame.size .width = self.editorScrollView .superview .frame .size .width ;
162+ self.editorScrollView .frame = editorTextViewFrame;
166163}
167164
168165#pragma mark - Updating
169166
170167- (void )updateTheme
171168{
172169 [self setFont: nil ];
173- [self updateTextView ];
174170
175171 [self setBackgroundColor: nil ];
176172 [self .selectionView setSelectionColor: nil ];
173+ [self .textView setBackgroundColor: self .backgroundColor];
177174}
178175
179176- (void )updateTextView
@@ -188,23 +185,17 @@ - (void)updateTextView
188185 return ;
189186 }
190187
191- [mutableAttributedString setAttributes: @{NSFontAttributeName : self.font , NSBackgroundColorAttributeName : self.backgroundColor } range: NSMakeRange (0 , mutableAttributedString.length)];
192-
188+ [mutableAttributedString setAttributes: @{NSFontAttributeName : self.font } range: NSMakeRange (0 , mutableAttributedString.length)];
193189 [self .textView.textStorage setAttributedString: mutableAttributedString];
194190}
195191
196192- (void )resizeWithOldSuperviewSize : (NSSize )oldSize
197193{
198194 [super resizeWithOldSuperviewSize: oldSize];
199- [self updateSelectionViewAnimated: YES ];
195+ [self updateSelectionView ];
200196}
201197
202198- (void )updateSelectionView
203- {
204- [self updateSelectionViewAnimated: NO ];
205- }
206-
207- - (void )updateSelectionViewAnimated : (BOOL )animated
208199{
209200 if ([self isHidden ]) {
210201 return ;
@@ -229,12 +220,8 @@ - (void)updateSelectionViewAnimated:(BOOL)animated
229220 ratio = (textHeight - self.selectionView .bounds .size .height ) / editorContentHeight;
230221 selectionViewFrame.origin .y = self.editorScrollView .contentView .bounds .origin .y * ratio;
231222 }
232-
233- if (animated) {
234- [self .selectionView.animator setFrame: selectionViewFrame];
235- } else {
236- [self .selectionView setFrame: selectionViewFrame];
237- }
223+
224+ [self .selectionView setFrame: selectionViewFrame];
238225}
239226
240227#pragma mark - NSLayoutManagerDelegate
0 commit comments