mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:30:48 +00:00
Handle the case where there is no layout information at all more efficiently.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18474 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a769eefc10
commit
eadf45d6d3
2 changed files with 19 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-01-25 04:15 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
|
* Source/NSLayoutManager.m (-invalidateDisplayForCharacterRange:,
|
||||||
|
-textStorage:edited:range:changeInLength:invalidatedRange:): Adjust
|
||||||
|
a few edge cases so that no work is done if there is no existing
|
||||||
|
layout information.
|
||||||
|
|
||||||
2004-01-24 15:17 Gregory John Casamento <greg_casamento@yahoo.com>
|
2004-01-24 15:17 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Headers/AppKit/NSDataLink.h: Added ivars.
|
* Headers/AppKit/NSDataLink.h: Added ivars.
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ TODO: not really clear what these should do
|
||||||
|
|
||||||
-(void) invalidateDisplayForCharacterRange: (NSRange)aRange
|
-(void) invalidateDisplayForCharacterRange: (NSRange)aRange
|
||||||
{
|
{
|
||||||
if (layout_char < aRange.location)
|
if (layout_char <= aRange.location)
|
||||||
return;
|
return;
|
||||||
if (layout_char < aRange.location + aRange.length)
|
if (layout_char < aRange.location + aRange.length)
|
||||||
aRange.length = layout_char - aRange.location;
|
aRange.length = layout_char - aRange.location;
|
||||||
|
@ -1777,6 +1777,7 @@ this file describes this.
|
||||||
NSRange r;
|
NSRange r;
|
||||||
unsigned int original_last_glyph, new_last_glyph;
|
unsigned int original_last_glyph, new_last_glyph;
|
||||||
int glyph_delta;
|
int glyph_delta;
|
||||||
|
BOOL had_layout;
|
||||||
|
|
||||||
/* printf("\n*** invalidating\n");
|
/* printf("\n*** invalidating\n");
|
||||||
[self _dumpLayout];*/
|
[self _dumpLayout];*/
|
||||||
|
@ -1789,6 +1790,7 @@ this file describes this.
|
||||||
TODO: make sure last_glyph is set as expected
|
TODO: make sure last_glyph is set as expected
|
||||||
*/
|
*/
|
||||||
original_last_glyph = layout_glyph;
|
original_last_glyph = layout_glyph;
|
||||||
|
had_layout = layout_char > 0;
|
||||||
|
|
||||||
if (!(mask & NSTextStorageEditedCharacters))
|
if (!(mask & NSTextStorageEditedCharacters))
|
||||||
lengthChange = 0;
|
lengthChange = 0;
|
||||||
|
@ -1804,7 +1806,9 @@ this file describes this.
|
||||||
layout_char = r.location;
|
layout_char = r.location;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layout_char == [_textStorage length])
|
if (!layout_char)
|
||||||
|
new_last_glyph = 0;
|
||||||
|
else if (layout_char == [_textStorage length])
|
||||||
new_last_glyph = [self numberOfGlyphs];
|
new_last_glyph = [self numberOfGlyphs];
|
||||||
else
|
else
|
||||||
new_last_glyph = [self glyphRangeForCharacterRange: NSMakeRange(layout_char, 1)
|
new_last_glyph = [self glyphRangeForCharacterRange: NSMakeRange(layout_char, 1)
|
||||||
|
@ -1814,7 +1818,7 @@ this file describes this.
|
||||||
/* printf("original=%i, new=%i, delta %i\n",
|
/* printf("original=%i, new=%i, delta %i\n",
|
||||||
original_last_glyph,new_last_glyph,glyph_delta);*/
|
original_last_glyph,new_last_glyph,glyph_delta);*/
|
||||||
|
|
||||||
if (r.location <= layout_char)
|
if (had_layout && r.location <= layout_char)
|
||||||
{
|
{
|
||||||
unsigned int glyph_index, last_glyph;
|
unsigned int glyph_index, last_glyph;
|
||||||
textcontainer_t *tc;
|
textcontainer_t *tc;
|
||||||
|
@ -1827,7 +1831,11 @@ this file describes this.
|
||||||
Note that r.location might equal layout_char, in which case
|
Note that r.location might equal layout_char, in which case
|
||||||
r.location won't actually have any text container or line frag.
|
r.location won't actually have any text container or line frag.
|
||||||
*/
|
*/
|
||||||
if (r.location == [_textStorage length])
|
if (!r.location)
|
||||||
|
{
|
||||||
|
glyph_index = 0;
|
||||||
|
}
|
||||||
|
else if (r.location == [_textStorage length])
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Since layout was built beyond r.location, glyphs must have been
|
Since layout was built beyond r.location, glyphs must have been
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue