mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Revert "Don’t refresh gutter from OakTextView"
Turns out this is required in the situation where the document occupy less space than the visible document rect.
In this case, inserting new lines will not resize the text view, since it has been artificially enlarged to fit the visible document rect, therefore the gutter view will not update properly when inserting new lines.
I think there is a better solution than have the text view refresh the gutter, reverting is just meant as a quick fix.
This reverts commit 4e2ae3c508.
This commit is contained in:
@@ -127,6 +127,18 @@ struct refresh_helper_t
|
||||
}
|
||||
}
|
||||
|
||||
static NSView* find_gutter_view (NSView* view)
|
||||
{
|
||||
for(NSView* candidate in [view subviews])
|
||||
{
|
||||
if([candidate isKindOfClass:NSClassFromString(@"GutterView")])
|
||||
return candidate;
|
||||
else if(NSView* res = find_gutter_view(candidate))
|
||||
return res;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
~refresh_helper_t ()
|
||||
{
|
||||
if(--_self.refreshNestCount == 0)
|
||||
@@ -156,8 +168,18 @@ struct refresh_helper_t
|
||||
if(!NSEqualSizes([_self frame].size, newSize))
|
||||
[_self setFrameSize:newSize];
|
||||
|
||||
NSView* gutterView = find_gutter_view([[_self enclosingScrollView] superview]);
|
||||
iterate(rect, damagedRects)
|
||||
{
|
||||
[_self setNeedsDisplayInRect:*rect];
|
||||
if(gutterView)
|
||||
{
|
||||
NSRect r = *rect;
|
||||
r.origin.x = 0;
|
||||
r.size.width = NSWidth([gutterView frame]);
|
||||
[gutterView setNeedsDisplayInRect:r];
|
||||
}
|
||||
}
|
||||
|
||||
if(_revision != _document->buffer().revision() || _selection != _editor->ranges())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user