From fb42853d2788c51470a0148b6d95aecb93b027cd Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Fri, 31 Aug 2007 07:37:44 +0000 Subject: [PATCH] U+2028 and U+2029 render as squares instead of causing line break. git-svn-id: http://macvim.googlecode.com/svn/trunk@222 96c4425d-ca35-0410-94e5-3396d5c13a8f --- MMTextStorage.h | 2 ++ MMTextStorage.m | 10 ++++++++++ MMTypesetter.m | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/MMTextStorage.h b/MMTextStorage.h index 0768793ca5..b2b619fd5b 100644 --- a/MMTextStorage.h +++ b/MMTextStorage.h @@ -36,6 +36,8 @@ - (int)maxRows; - (int)maxColumns; +- (int)actualRows; +- (int)actualColumns; - (void)getMaxRows:(int*)rows columns:(int*)cols; - (void)setMaxRows:(int)rows columns:(int)cols; - (void)replaceString:(NSString *)string atRow:(int)row column:(int)col diff --git a/MMTextStorage.m b/MMTextStorage.m index 8694d54195..ede428935a 100644 --- a/MMTextStorage.m +++ b/MMTextStorage.m @@ -143,6 +143,16 @@ return maxColumns; } +- (int)actualRows +{ + return actualRows; +} + +- (int)actualColumns +{ + return actualColumns; +} + - (void)getMaxRows:(int*)rows columns:(int*)cols { if (rows) *rows = maxRows; diff --git a/MMTypesetter.m b/MMTypesetter.m index 388107dd9c..e847892d3d 100644 --- a/MMTypesetter.m +++ b/MMTypesetter.m @@ -13,6 +13,8 @@ #import "MacVim.h" +#define MM_USE_LINERANGE 0 + #if 0 @interface MMTypesetter (Private) @@ -61,6 +63,7 @@ unsigned i, numberOfLines = 0, firstLine = 0; NSRange firstLineRange = { 0, 0 }; +#if MM_USE_LINERANGE // Find the first line and its range, and count the number of lines. (This // info could also be gleaned from MMTextStorage, but we do it here anyway // to make absolutely sure everything is right.) @@ -73,6 +76,14 @@ i = NSMaxRange(lineRange); } +#else + unsigned stride = 1 + [ts actualColumns]; + numberOfLines = [ts actualRows]; + firstLine = (unsigned)(startCharIdx/stride); + firstLineRange.location = firstLine * stride; + unsigned len = [text length] - firstLineRange.location; + firstLineRange.length = len < stride ? len : stride; +#endif // Perform line fragment generation one line at a time. NSRange lineRange = firstLineRange; @@ -105,7 +116,14 @@ } } +#if MM_USE_LINERANGE lineRange = [text lineRangeForRange:NSMakeRange(endLineIdx, 0)]; +#else + lineRange.location = endLineIdx; + len = [text length] - lineRange.location; + if (len < lineRange.length) + lineRange.length = len; +#endif } if (nextGlyph)