Skip to content

Instantly share code, notes, and snippets.

@saitoha
Created June 3, 2013 15:43
Show Gist options
  • Select an option

  • Save saitoha/5699078 to your computer and use it in GitHub Desktop.

Select an option

Save saitoha/5699078 to your computer and use it in GitHub Desktop.
Quickfix patch for Term2 1.0.0.20130602 beta rendering bug.
diff --git a/PTYTextView.m b/PTYTextView.m
index a08115e..1cf1251 100644
--- a/PTYTextView.m
+++ b/PTYTextView.m
@@ -6150,6 +6150,7 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
CGFloat curX = initialPoint.x;
CharacterRun *thisChar = [[[CharacterRun alloc] init] autorelease];
thisChar.advancedFontRendering = advancedFontRendering;
+ BOOL doubleWidthCache = NO;
for (int i = indexRange.location; i < indexRange.location + indexRange.length; i++) {
if (theLine[i].code == DWC_RIGHT) {
continue;
@@ -6278,7 +6279,7 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
// imply pointer equality). This is fragile but fast and any false
// negatives have a minor performance hit.
BOOL beginNewRun = NO;
- if (!havePrevChar || ![thisChar isCompatibleWith:prevChar]) {
+ if (doubleWidth != doubleWidthCache || !havePrevChar || ![thisChar isCompatibleWith:prevChar]) {
beginNewRun = YES;
havePrevChar = YES;
}
@@ -6317,6 +6318,7 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
prevChar.color = thisChar.color;
prevChar.fakeBold = thisChar.fakeBold;
prevChar.antiAlias = thisChar.antiAlias;
+ doubleWidthCache = doubleWidth;
}
[currentRun commit];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment