mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
More careful checking for the special case of no text
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@13683 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
225ea56b25
commit
0d7e20cacf
1 changed files with 28 additions and 6 deletions
|
@ -542,12 +542,20 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
{
|
||||
int i;
|
||||
int min = 0;
|
||||
int max = MAX(0, [_lineLayoutInformation count] - 1);
|
||||
int max = MAX(0, (int)[_lineLayoutInformation count] - 1);
|
||||
float y = point.y;
|
||||
float fmin = NSMinY([[_lineLayoutInformation objectAtIndex: 0] lineFragmentRect]);
|
||||
float fmax = NSMaxY([[_lineLayoutInformation lastObject] lineFragmentRect]);
|
||||
float fmin;
|
||||
float fmax;
|
||||
NSRect rect;
|
||||
|
||||
if (max == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
fmin = NSMinY([[_lineLayoutInformation objectAtIndex: 0] lineFragmentRect]);
|
||||
fmax = NSMaxY([[_lineLayoutInformation lastObject] lineFragmentRect]);
|
||||
|
||||
if (y >= fmax)
|
||||
return max;
|
||||
|
||||
|
@ -590,8 +598,10 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
unsigned fmax;
|
||||
NSRange range;
|
||||
|
||||
if (!max)
|
||||
return 0;
|
||||
if (max == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
fmin = [[_lineLayoutInformation objectAtIndex: 0] glyphRange].location;
|
||||
fmax = NSMaxRange([[_lineLayoutInformation lastObject] glyphRange]);
|
||||
|
@ -636,6 +646,11 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
unsigned startIndex;
|
||||
unsigned endIndex;
|
||||
|
||||
if ([_lineLayoutInformation count] == 0)
|
||||
{
|
||||
return NSMakeRange (0, 0);
|
||||
}
|
||||
|
||||
if (startLine >= [_lineLayoutInformation count])
|
||||
currentInfo = [_lineLayoutInformation lastObject];
|
||||
else
|
||||
|
@ -727,10 +742,17 @@ forStartOfGlyphRange: (NSRange)glyphRange
|
|||
// relies on _lineLayoutInformation
|
||||
- (void) drawLinesInLineRange: (NSRange)aRange;
|
||||
{
|
||||
NSArray *linesToDraw = [_lineLayoutInformation subarrayWithRange: aRange];
|
||||
NSArray *linesToDraw;
|
||||
NSEnumerator *lineEnum;
|
||||
_GNULineLayoutInfo *currentInfo;
|
||||
|
||||
if ([_lineLayoutInformation count] == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
linesToDraw = [_lineLayoutInformation subarrayWithRange: aRange];
|
||||
|
||||
for ((lineEnum = [linesToDraw objectEnumerator]);
|
||||
(currentInfo = [lineEnum nextObject]);)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue