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:
Alexander Malmberg 2003-02-24 02:53:20 +00:00
parent 6397b61a2a
commit 4c0d68496c
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.

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)
lo = mid + 1;
else
hi = lo;
hi = lo = mid;
}
i = lo;
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_range.length = i + pos - glyph_range.location;
glyph_range.length = i + pos - glyph_range.location;
if (i == r->head.glyph_length)
char_range.length = glyphs->char_length - char_range.location;
else
@ -1236,6 +1236,11 @@ places where we switch.
This happens a lot with repeated single-character insertions, aka.
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 &&
context[0]->char_length < 16)
{