Added invalidation of text position during editing

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8482 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2001-01-07 00:53:53 +00:00
parent b6038bc341
commit 0fe5dd2861

View file

@ -451,6 +451,7 @@ static NSCharacterSet *invSelectionWordGranularitySet;
delta: 0 delta: 0
inTextContainer: aTextContainer]; inTextContainer: aTextContainer];
[[aTextContainer textView] sizeToFit]; [[aTextContainer textView] sizeToFit];
[[aTextContainer textView] invalidateTextContainerOrigin];
if (actualRange) if (actualRange)
*actualRange = [self glyphRangeForLineLayoutRange: lineRange]; *actualRange = [self glyphRangeForLineLayoutRange: lineRange];
@ -478,13 +479,15 @@ static NSCharacterSet *invSelectionWordGranularitySet;
lineRange = [self rebuildForRange: aRange lineRange = [self rebuildForRange: aRange
delta: delta delta: delta
inTextContainer: aTextContainer]; inTextContainer: aTextContainer];
// ScrollView interaction
[[aTextContainer textView] sizeToFit]; [[aTextContainer textView] sizeToFit];
[[aTextContainer textView] invalidateTextContainerOrigin];
[self setNeedsDisplayForLineRange: lineRange [self setNeedsDisplayForLineRange: lineRange
inTextContainer: aTextContainer]; 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 - (void)drawBackgroundForGlyphRange:(NSRange)glyphRange
atPoint:(NSPoint)containerOrigin atPoint:(NSPoint)containerOrigin
{ {
@ -493,6 +496,8 @@ static NSCharacterSet *invSelectionWordGranularitySet;
NSRect rect = [self boundingRectForGlyphRange: glyphRange NSRect rect = [self boundingRectForGlyphRange: glyphRange
inTextContainer: aTextContainer]; inTextContainer: aTextContainer];
/* FIXME: Which means that the following <which assumes we are
drawing in a text view> can't be correct */
// clear area under text // clear area under text
[[[aTextContainer textView] backgroundColor] set]; [[[aTextContainer textView] backgroundColor] set];
NSRectFill(rect); NSRectFill(rect);
@ -699,20 +704,22 @@ forStartOfGlyphRange: (NSRange)glyphRange
rect.size.height); rect.size.height);
} }
- (void) drawSelectionAsRangeNoCaret: (NSRange) aRange - (void) drawSelectionAsRangeNoCaret: (NSRange)aRange
{ {
int i; unsigned i, count;
unsigned count; NSTextContainer *aTextContainer;
NSTextContainer *aTextContainer = [self textContainerForGlyphAtIndex: aRange.location NSRect *rects;
effectiveRange: NULL];
NSRect *rects = [self rectArrayForCharacterRange: aRange aTextContainer = [self textContainerForGlyphAtIndex: aRange.location
withinSelectedCharacterRange: aRange effectiveRange: NULL];
inTextContainer: aTextContainer rects = [self rectArrayForCharacterRange: aRange
rectCount: &count]; withinSelectedCharacterRange: aRange
inTextContainer: aTextContainer
rectCount: &count];
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
NSHighlightRect(rects[i]); NSHighlightRect (rects[i]);
} }
} }
@ -746,7 +753,7 @@ forStartOfGlyphRange: (NSRange)glyphRange
} }
- (void) setNeedsDisplayForLineRange: (NSRange)redrawLineRange - (void) setNeedsDisplayForLineRange: (NSRange)redrawLineRange
inTextContainer:(NSTextContainer *)aTextContainer inTextContainer: (NSTextContainer *)aTextContainer
{ {
if ([_lineLayoutInformation count] if ([_lineLayoutInformation count]
&& redrawLineRange.location < [_lineLayoutInformation count] && redrawLineRange.location < [_lineLayoutInformation count]
@ -931,8 +938,9 @@ scanRange(NSScanner *scanner, NSCharacterSet* aSet)
// Process a paragraph // Process a paragraph
do do
{ {
// Temporary added a autorelease pool, as the current layout mechnism // Temporary added a autorelease pool, as the current layout
// uses up much memory space, that should be freed as soon as possible. // mechanism uses up much memory space, that should be freed
// as soon as possible.
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);
NSRect fragmentRect; NSRect fragmentRect;
NSRect usedLineRect; NSRect usedLineRect;