Skip to content

Commit 3d8e6c3

Browse files
committed
Fix hollow cursor drawing on Retina display
This fixes a problem where the hollow cursor was asymmetrical on a Retina display.
1 parent 798c96e commit 3d8e6c3

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

src/MacVim/MMCoreTextView.m

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,6 @@ - (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
12651265
{
12661266
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
12671267
NSRect rect = [self rectForRow:row column:col numRows:1 numColumns:1];
1268-
CGRect clipRect = *(CGRect *)▭
12691268

12701269
CGContextSaveGState(context);
12711270

@@ -1286,18 +1285,16 @@ - (void)drawInsertionPointAtRow:(int)row column:(int)col shape:(int)shape
12861285
// over into adjacent display cells and it may look ugly.
12871286
CGContextSetShouldAntialias(context, NO);
12881287

1289-
// Even though antialiasing is disabled and we adjust the rect to fit
1290-
// inside the display cell it still happens on Retina displays (only) that
1291-
// the cursor bleeds over into the neighboring cells. To work around this
1292-
// issue we enable clipping.
1293-
CGContextClipToRect(context, clipRect);
1294-
12951288
if (MMInsertionPointHollow == shape) {
12961289
// When stroking a rect its size is effectively 1 pixel wider/higher
12971290
// than we want so make it smaller to avoid having it bleed over into
12981291
// the adjacent display cell.
1292+
// We also have to shift the rect by half a point otherwise it will be
1293+
// partially drawn outside its bounds on a Retina display.
12991294
rect.size.width -= 1;
13001295
rect.size.height -= 1;
1296+
rect.origin.x += 0.5;
1297+
rect.origin.y += 0.5;
13011298

13021299
CGContextSetRGBStrokeColor(context, RED(color), GREEN(color),
13031300
BLUE(color), ALPHA(color));

0 commit comments

Comments
 (0)