@@ -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];
@@ -68,15 +68,12 @@ - (NSTextView *)textView
6868{
6969 if (_textView == nil ) {
7070 _textView = [[NSTextView alloc ] initWithFrame: self .bounds];
71- [_textView setAutoresizingMask: NSViewMinXMargin | NSViewMaxXMargin | NSViewWidthSizable | NSViewHeightSizable];
7271 [_textView setBackgroundColor: [NSColor clearColor ]];
7372
7473 [_textView.textContainer setLineFragmentPadding: 0 .0f ];
7574
7675 [_textView.layoutManager setDelegate: self ];
77- // [_textView.layoutManager setAllowsNonContiguousLayout:YES];
78- // [_textView.layoutManager setBackgroundLayoutEnabled:YES];
79-
76+
8077 [_textView setAllowsUndo: NO ];
8178 [_textView setAllowsImageEditing: NO ];
8279 [_textView setAutomaticDashSubstitutionEnabled: NO ];
@@ -154,9 +151,9 @@ - (void)show
154151{
155152 self.hidden = NO ;
156153
157- NSRect editorTextViewFrame = self.editorTextView .frame ;
158- editorTextViewFrame .size .width = self.editorTextView .superview .frame .size .width - self.bounds .size .width - kRightSidePadding ;
159- self.editorTextView .frame = editorTextViewFrame ;
154+ NSRect frame = self.editorScrollView .frame ;
155+ frame .size .width = self.editorScrollView .superview .frame .size .width - self.bounds .size .width ;
156+ self.editorScrollView .frame = frame ;
160157
161158 [self updateTextView ];
162159 [self updateSelectionView ];
@@ -166,9 +163,9 @@ - (void)hide
166163{
167164 self.hidden = YES ;
168165
169- NSRect editorTextViewFrame = self.editorTextView .frame ;
170- editorTextViewFrame .size .width = self.editorTextView .superview .frame .size .width ;
171- self.editorTextView .frame = editorTextViewFrame ;
166+ NSRect frame = self.editorScrollView .frame ;
167+ frame .size .width = self.editorScrollView .superview .frame .size .width ;
168+ self.editorScrollView .frame = frame ;
172169}
173170
174171#pragma mark - Updating
@@ -180,6 +177,7 @@ - (void)updateTheme
180177
181178 [self setBackgroundColor: nil ];
182179 [self .selectionView setSelectionColor: nil ];
180+ [self .textView setBackgroundColor: self .backgroundColor];
183181}
184182
185183- (void )updateTextView
@@ -194,24 +192,18 @@ - (void)updateTextView
194192 return ;
195193 }
196194
197- [mutableAttributedString setAttributes: @{NSFontAttributeName : self.font , NSBackgroundColorAttributeName : self.backgroundColor } range: NSMakeRange (0 , mutableAttributedString.length)];
198-
195+ [mutableAttributedString setAttributes: @{NSFontAttributeName : self.font } range: NSMakeRange (0 , mutableAttributedString.length)];
199196 [self .textView.textStorage setAttributedString: mutableAttributedString];
200197 [mutableAttributedString release ];
201198}
202199
203200- (void )resizeWithOldSuperviewSize : (NSSize )oldSize
204201{
205202 [super resizeWithOldSuperviewSize: oldSize];
206- [self updateSelectionViewAnimated: YES ];
203+ [self updateSelectionView ];
207204}
208205
209206- (void )updateSelectionView
210- {
211- [self updateSelectionViewAnimated: NO ];
212- }
213-
214- - (void )updateSelectionViewAnimated : (BOOL )animated
215207{
216208 if ([self isHidden ]) {
217209 return ;
@@ -237,11 +229,7 @@ - (void)updateSelectionViewAnimated:(BOOL)animated
237229 selectionViewFrame.origin .y = self.editorScrollView .contentView .bounds .origin .y * ratio;
238230 }
239231
240- if (animated) {
241- [self .selectionView.animator setFrame: selectionViewFrame];
242- } else {
243- [self .selectionView setFrame: selectionViewFrame];
244- }
232+ [self .selectionView setFrame: selectionViewFrame];
245233}
246234
247235#pragma mark - NSLayoutManagerDelegate
0 commit comments