mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-24 06:28:54 +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
af88bed81e
commit
5ce50e1384
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>
|
||||
|
||||
* Headers/AppKit/NSDataLink.h: Added ivars.
|
||||
|
|
|
@ -1689,7 +1689,7 @@ TODO: not really clear what these should do
|
|||
|
||||
-(void) invalidateDisplayForCharacterRange: (NSRange)aRange
|
||||
{
|
||||
if (layout_char < aRange.location)
|
||||
if (layout_char <= aRange.location)
|
||||
return;
|
||||
if (layout_char < aRange.location + aRange.length)
|
||||
aRange.length = layout_char - aRange.location;
|
||||
|
@ -1777,6 +1777,7 @@ this file describes this.
|
|||
NSRange r;
|
||||
unsigned int original_last_glyph, new_last_glyph;
|
||||
int glyph_delta;
|
||||
BOOL had_layout;
|
||||
|
||||
/* printf("\n*** invalidating\n");
|
||||
[self _dumpLayout];*/
|
||||
|
@ -1789,6 +1790,7 @@ this file describes this.
|
|||
TODO: make sure last_glyph is set as expected
|
||||
*/
|
||||
original_last_glyph = layout_glyph;
|
||||
had_layout = layout_char > 0;
|
||||
|
||||
if (!(mask & NSTextStorageEditedCharacters))
|
||||
lengthChange = 0;
|
||||
|
@ -1804,7 +1806,9 @@ this file describes this.
|
|||
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];
|
||||
else
|
||||
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",
|
||||
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;
|
||||
textcontainer_t *tc;
|
||||
|
@ -1827,7 +1831,11 @@ this file describes this.
|
|||
Note that r.location might equal layout_char, in which case
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue