Fix handling of the case where the exact glyph is found during the binary search.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16060 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-02-24 02:53:20 +00:00
parent 2c93b50ebd
commit a54da88ec2
2 changed files with 19 additions and 3 deletions

View file

@ -1,4 +1,15 @@
2003-02-23 00:02 Alexander Malmberg <alexander@malmberg.org> 2003-02-24 03:49 Alexander Malmberg <alexander@malmberg.org>
* Source/GSLayoutManager.m (-_glyphForCharacter:index:positions::):
Fix handling of the case where the exact glyph is found during
the binary search.
* Source/NSLayoutManager.m (-drawGlyphsForGlyphRange:atPoint:):
Check that a range has a background color before checking that there
are rectangles for it (since ranges practically always have
rectangles, and very rarely a background color).
2003-02-24 00:02 Alexander Malmberg <alexander@malmberg.org>
* Source/NSParagraphStyle.m: Implement -isEqual: and -hash. * Source/NSParagraphStyle.m: Implement -isEqual: and -hash.

View file

@ -581,7 +581,7 @@ static glyph_run_t *run_insert(glyph_run_head_t **context)
else if (r->glyphs[mid].char_offset < target) else if (r->glyphs[mid].char_offset < target)
lo = mid + 1; lo = mid + 1;
else else
hi = lo; hi = lo = mid;
} }
i = lo; i = lo;
while (r->glyphs[i].char_offset > target) while (r->glyphs[i].char_offset > target)
@ -907,7 +907,7 @@ static glyph_run_t *run_insert(glyph_run_head_t **context)
GLYPH_SCAN_FORWARD(r, i, pos, cpos, r->glyphs[i].char_offset + cpos <= target) GLYPH_SCAN_FORWARD(r, i, pos, cpos, r->glyphs[i].char_offset + cpos <= target)
glyph_range.length = i + pos - glyph_range.location; glyph_range.length = i + pos - glyph_range.location;
if (i == r->head.glyph_length) if (i == r->head.glyph_length)
char_range.length = glyphs->char_length - char_range.location; char_range.length = glyphs->char_length - char_range.location;
else else
@ -1236,6 +1236,11 @@ places where we switch.
This happens a lot with repeated single-character insertions, aka. This happens a lot with repeated single-character insertions, aka.
typing in a text view. typing in a text view.
*/ */
/*
TODO: This is not triggered if a character is added at the very end
of the text. Might be a good idea to merge runs in that case, too.
Maybe do it in -_generateRunsToCharacter:, instead.
*/
if (rng.location < ch && context[0]->char_length && if (rng.location < ch && context[0]->char_length &&
context[0]->char_length < 16) context[0]->char_length < 16)
{ {