diff --git a/ChangeLog b/ChangeLog index 5de5c0fe9..f18f3bdd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-02-23 01:59 Alexander Malmberg + + * Headers/gnustep/gui/GSLayoutManager_internal.h, + Source/GSLayoutManager.m, Source/NSLayoutManager.m: Use num_linefrags + to tell whether layout has started for a text container or not, + instead of tracking the status separately. + 2003-02-22 12:29 Alexander Malmberg * Source/NSApplication.m (-sendEvent:): Only bring up the main diff --git a/Headers/gnustep/gui/GSLayoutManager_internal.h b/Headers/gnustep/gui/GSLayoutManager_internal.h index aa4757a98..3b662ab97 100644 --- a/Headers/gnustep/gui/GSLayoutManager_internal.h +++ b/Headers/gnustep/gui/GSLayoutManager_internal.h @@ -168,7 +168,7 @@ typedef struct GSLayoutManager_textcontainer_s { NSTextContainer *textContainer; - BOOL started, complete; + BOOL complete; unsigned int pos, length; /* diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index 0822cc490..f440d94f2 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -1447,7 +1447,7 @@ places where we switch. for (i = idx, tc = textcontainers + idx; i < num_textcontainers; i++, tc++) { - tc->started = tc->complete = NO; + tc->complete = NO; if (tc->linefrags) { for (j = 0, lf = tc->linefrags; j < tc->num_linefrags + tc->num_soft; j++, lf++) @@ -1468,7 +1468,7 @@ places where we switch. } for (i = idx - 1, tc = textcontainers + idx - 1; i >= 0; i--, tc--) { - if (tc->started) + if (tc->num_linefrags) { layout_glyph = tc->pos + tc->length; if (layout_glyph == glyphs->glyph_length) @@ -1641,7 +1641,8 @@ by calling this incorrectly. return; } - if (tc->started) + /* Assume that no line frags means that layout hasn't started yet. */ + if (tc->num_linefrags) { if (glyphRange.location != tc->pos + tc->length) { @@ -1663,7 +1664,6 @@ by calling this incorrectly. } tc->pos = 0; tc->length = glyphRange.length; - tc->started = YES; } else { @@ -1676,7 +1676,6 @@ by calling this incorrectly. } tc->pos = glyphRange.location; tc->length = glyphRange.length; - tc->started = YES; } { diff --git a/Source/NSLayoutManager.m b/Source/NSLayoutManager.m index 74015954c..1fdb990de 100644 --- a/Source/NSLayoutManager.m +++ b/Source/NSLayoutManager.m @@ -1666,7 +1666,7 @@ TODO: not really clear what these should do for (i = 0; i < num_textcontainers; i++) { - if (!textcontainers[i].started) + if (!textcontainers[i].num_linefrags) break; if (textcontainers[i].pos >= aRange.location + aRange.length) @@ -1742,7 +1742,8 @@ TODO: not really clear what these should do for (i = 0, tc = textcontainers; i < num_textcontainers; i++, tc++) { - printf("tc %2i, %5i+%5i\n",i,tc->pos,tc->length); + printf("tc %2i, %5i+%5i (complete %i)\n", + i,tc->pos,tc->length,tc->complete); printf(" lfs: (%3i)\n", tc->num_linefrags); for (j = 0, lf = tc->linefrags; j < tc->num_linefrags; j++, lf++) { @@ -1768,6 +1769,7 @@ TODO: not really clear what these should do printf(" a%3i : %5i+%5i\n",k,la->pos,la->length); } } + printf("layout to: char %i, glyph %i\n",layout_char,layout_glyph); } @@ -1953,7 +1955,6 @@ this file describes this. else { tc->pos = tc->length = 0; - tc->started = NO; } j++, tc++; @@ -1985,12 +1986,11 @@ this file describes this. tc->complete = NO; if (new_num) { - tc->length = tc->linefrags[new_num-1].pos + tc->linefrags[new_num-1].length - tc->pos; + tc->length = tc->linefrags[new_num - 1].pos + tc->linefrags[new_num - 1].length - tc->pos; } else { tc->pos = tc->length = 0; - tc->started = NO; } /* @@ -2019,7 +2019,7 @@ no_soft_invalidation: /* Set layout_glyph and layout_char. */ for (i = num_textcontainers - 1, tc = textcontainers + i; i >= 0; i--, tc--) { - if (tc->started) + if (tc->num_linefrags) { layout_glyph = tc->pos + tc->length; if (layout_glyph == glyphs->glyph_length)