From a54da88ec27cafe748967d68a8f3dcb194f12a11 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 24 Feb 2003 02:53:20 +0000 Subject: [PATCH] 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 --- ChangeLog | 13 ++++++++++++- Source/GSLayoutManager.m | 9 +++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2b4ede551..bab78e997 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,15 @@ -2003-02-23 00:02 Alexander Malmberg +2003-02-24 03:49 Alexander Malmberg + + * 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 * Source/NSParagraphStyle.m: Implement -isEqual: and -hash. diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index f440d94f2..1f1358ff6 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -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) {