From 781cb5d1b47fc54cd962bc45f0f1ef09e54e1546 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 6 Feb 2002 01:06:03 +0000 Subject: [PATCH] Indentation changes git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12413 72102866-910b-0410-8b05-ffd578937521 --- Source/GSSimpleLayoutManager.m | 37 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Source/GSSimpleLayoutManager.m b/Source/GSSimpleLayoutManager.m index b6017db96..cc92da340 100644 --- a/Source/GSSimpleLayoutManager.m +++ b/Source/GSSimpleLayoutManager.m @@ -496,25 +496,23 @@ static NSCharacterSet *invSelectionWordGranularitySet; inTextContainer: aTextContainer]; } -/* FIXME: According to the doc, the following method should be able to - * draw in any view after the focus has been locked on it. */ -- (void)drawBackgroundForGlyphRange:(NSRange)glyphRange - atPoint:(NSPoint)containerOrigin +- (void)drawBackgroundForGlyphRange: (NSRange)glyphRange + atPoint: (NSPoint)containerOrigin { - NSTextContainer *aTextContainer = [self textContainerForGlyphAtIndex: glyphRange.location - effectiveRange: NULL]; - NSRect rect = [self boundingRectForGlyphRange: glyphRange - inTextContainer: aTextContainer]; + NSTextContainer *aTextContainer; + + aTextContainer = [self textContainerForGlyphAtIndex: glyphRange.location + effectiveRange: NULL]; - /* FIXME: Which means that the following can't be correct */ - // clear area under text [[[aTextContainer textView] backgroundColor] set]; - NSRectFill(rect); + + NSRectFill ([self boundingRectForGlyphRange: glyphRange + inTextContainer: aTextContainer]); + } -- (void)drawGlyphsForGlyphRange:(NSRange)glyphRange - atPoint:(NSPoint)containerOrigin +- (void)drawGlyphsForGlyphRange: (NSRange)glyphRange + atPoint: (NSPoint)containerOrigin { NSRange newRange; NSRange selectedRange = [[self firstTextView] selectedRange]; @@ -563,7 +561,8 @@ forStartOfGlyphRange: (NSRange)glyphRange - (NSSize) _sizeOfRange: (NSRange)aRange { - if (aRange.length == 0 || _textStorage == nil + if (aRange.length == 0 + || _textStorage == nil || NSMaxRange(aRange) > [_textStorage length]) { return NSZeroSize; @@ -935,9 +934,10 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet) unsigned position; // Position in NSString. NSRect remainingRect = NSZeroRect; - // Determine the range of the next paragraph of text (in 'para') and set - // 'paraPos' to point after the terminating newline character (if any). - para = NSMakeRange(paraPos, length - paraPos); + /* Determine the range of the next paragraph of text (in 'para') + and set 'paraPos' to point after the terminating newline + character (if any). */ + para = NSMakeRange (paraPos, length - paraPos); eol = [allText rangeOfCharacterFromSet: newlines options: NSLiteralSearch range: para]; @@ -954,6 +954,7 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet) position = para.location; paragraph = [allText substringWithRange: para]; + lScanner = [NSScanner scannerWithString: paragraph]; [lScanner setCharactersToBeSkipped: nil];