mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Fix vert split problems in Core Text renderer
The display is no longer corrupted on :vsp when using the Core Text renderer. Also fixes a problem where background would not be cleared correctly when left scrollbar was visible. Remove a hack in live resizing code when using CT. This may cause the window to flicker more during live resize (have to find a better fix).
This commit is contained in:
@@ -37,8 +37,6 @@
|
||||
unsigned maxlen;
|
||||
CGGlyph *glyphs;
|
||||
CGSize *advances;
|
||||
|
||||
NSRect lastClearRect;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(NSRect)frame;
|
||||
|
||||
@@ -567,21 +567,6 @@ defaultAdvanceForFont(CTFontRef fontRef)
|
||||
NSGraphicsContext *context = [NSGraphicsContext currentContext];
|
||||
[context setShouldAntialias:antialias];
|
||||
|
||||
NSRect frame = [self frame];
|
||||
if (!NSEqualRects(lastClearRect, frame)) {
|
||||
// HACK! If the view frame changes then clear the entire frame
|
||||
// otherwise the screen flickers e.g. when the window is resized.
|
||||
#if 1
|
||||
[self clearAll];
|
||||
#else
|
||||
float y = frame.size.height - lastClearRect.size.height;
|
||||
if (y > 0 && y < frame.size.height) {
|
||||
NSCopyBits(0, lastClearRect, NSMakePoint(0, y));
|
||||
}
|
||||
#endif
|
||||
lastClearRect = frame;
|
||||
}
|
||||
|
||||
id data;
|
||||
NSEnumerator *e = [drawData objectEnumerator];
|
||||
while ((data = [e nextObject]))
|
||||
@@ -726,7 +711,7 @@ defaultAdvanceForFont(CTFontRef fontRef)
|
||||
// View is not flipped, instead the atsui code draws to a flipped image;
|
||||
// thus we need to 'flip' the coordinate here since the column number
|
||||
// increases in an up-to-down order.
|
||||
point.y = [self frame].size.height - point.y;
|
||||
point.y = [self bounds].size.height - point.y;
|
||||
|
||||
NSPoint origin = { insetSize.width, insetSize.height };
|
||||
|
||||
@@ -801,7 +786,7 @@ defaultAdvanceForFont(CTFontRef fontRef)
|
||||
|
||||
- (NSPoint)pointForRow:(int)row column:(int)col
|
||||
{
|
||||
NSRect frame = [self frame];
|
||||
NSRect frame = [self bounds];
|
||||
return NSMakePoint(
|
||||
col*cellSize.width + insetSize.width,
|
||||
frame.size.height - (row+1)*cellSize.height - insetSize.height);
|
||||
@@ -811,7 +796,7 @@ defaultAdvanceForFont(CTFontRef fontRef)
|
||||
numColumns:(int)nc
|
||||
{
|
||||
NSRect rect;
|
||||
NSRect frame = [self frame];
|
||||
NSRect frame = [self bounds];
|
||||
|
||||
rect.origin.x = col*cellSize.width + insetSize.width;
|
||||
rect.origin.y = frame.size.height - (row+nr)*cellSize.height -
|
||||
@@ -825,7 +810,7 @@ defaultAdvanceForFont(CTFontRef fontRef)
|
||||
- (NSRect)rectFromRow:(int)row1 column:(int)col1
|
||||
toRow:(int)row2 column:(int)col2
|
||||
{
|
||||
NSRect frame = [self frame];
|
||||
NSRect frame = [self bounds];
|
||||
return NSMakeRect(
|
||||
insetSize.width + col1*cellSize.width,
|
||||
frame.size.height - insetSize.height - (row2+1)*cellSize.height,
|
||||
@@ -1069,7 +1054,7 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
|
||||
backgroundColor:(int)bg specialColor:(int)sp
|
||||
{
|
||||
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||
NSRect frame = [self frame];
|
||||
NSRect frame = [self bounds];
|
||||
float x = col*cellSize.width + insetSize.width;
|
||||
float y = frame.size.height - insetSize.height - (1+row)*cellSize.height;
|
||||
float w = cellSize.width;
|
||||
@@ -1232,7 +1217,7 @@ recurseDraw(const unichar *chars, CGGlyph *glyphs, CGSize *advances,
|
||||
- (void)clearAll
|
||||
{
|
||||
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||
NSRect rect = [self frame];
|
||||
NSRect rect = [self bounds];
|
||||
float r = [defaultBackgroundColor redComponent];
|
||||
float g = [defaultBackgroundColor greenComponent];
|
||||
float b = [defaultBackgroundColor blueComponent];
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
BOOL vimTaskSelectedTab;
|
||||
MMTextView *textView;
|
||||
NSMutableArray *scrollbars;
|
||||
NSRect lastTextViewFrame;
|
||||
}
|
||||
|
||||
- (MMVimView *)initWithFrame:(NSRect)frame vimController:(MMVimController *)c;
|
||||
|
||||
+12
-1
@@ -191,6 +191,17 @@ enum {
|
||||
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
NSRect textViewFrame = [textView frame];
|
||||
if (!NSEqualRects(lastTextViewFrame, textViewFrame)) {
|
||||
// If the text view's frame changes we copy the contents of the old
|
||||
// frame to the origin of the new frame. The reason for this is that
|
||||
// Vim expects the contents of its view not to change unless Vim
|
||||
// changes it. (Omitting this code causes the view contents to get
|
||||
// messed up e.g. when the left scrollbar is shown.)
|
||||
NSCopyBits(0, lastTextViewFrame, textViewFrame.origin);
|
||||
lastTextViewFrame = textViewFrame;
|
||||
}
|
||||
|
||||
// On Leopard, we want to have a textured window background for nice
|
||||
// looking tabs. However, the textured window background looks really
|
||||
// weird behind the window resize throbber, so emulate the look of an
|
||||
@@ -224,7 +235,7 @@ enum {
|
||||
// If the left scrollbar is visible there is an empty square under it.
|
||||
// Fill it in just like on the right hand corner. The half pixel
|
||||
// offset ensures the outline goes on the top and right side of the
|
||||
// square; the left and bottom parts are clipped.
|
||||
// square; the left and bottom parts of the outline are clipped.
|
||||
sizerRect = NSMakeRect(-.5,-.5,sw,sw);
|
||||
path = [NSBezierPath bezierPathWithRect:sizerRect];
|
||||
[[NSColor controlBackgroundColor] set];
|
||||
|
||||
Reference in New Issue
Block a user