--- GSSimpleLayoutManager.m.orig Tue Jun 25 09:15:37 2002 +++ GSSimpleLayoutManager.m Tue Jul 9 14:59:44 2002 @@ -511,8 +511,6 @@ unsigned end = [self lineLayoutIndexForGlyphIndex: NSMaxRange(glyphRange)]; NSRange lineRange = NSMakeRange(start, end + 1 - start); - [self drawLinesInLineRange: lineRange]; - // We have to redraw the part of the selection that is inside // the redrawn lines newRange = NSIntersectionRange(selectedRange, glyphRange); @@ -522,6 +521,8 @@ { [self drawSelectionAsRangeNoCaret: newRange]; } + + [self drawLinesInLineRange: lineRange]; } - (void) setLineFragmentRect: (NSRect)fragmentRect @@ -726,20 +727,11 @@ - (void) drawSelectionAsRangeNoCaret: (NSRange)aRange { - unsigned i, count; - NSTextContainer *aTextContainer; - NSRect *rects; - - aTextContainer = [self textContainerForGlyphAtIndex: aRange.location - effectiveRange: NULL]; - rects = [self rectArrayForCharacterRange: aRange - withinSelectedCharacterRange: aRange - inTextContainer: aTextContainer - rectCount: &count]; - - for (i = 0; i < count; i++) + if (aRange.length) { - NSHighlightRect (rects[i]); + [_textStorage addAttribute: NSBackgroundColorAttributeName + value: [NSColor selectedTextBackgroundColor] + range: aRange]; } }