From 6d950f4cb0638638cdcd3c6f60ec96058499015c Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Sat, 18 Nov 2000 23:56:52 +0000 Subject: [PATCH] (update_text_area): Fix last change. --- src/ChangeLog | 4 +++ src/dispnew.c | 71 ++++++++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 32 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 20f2f1d6345..2ac749849c8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2000-11-19 Gerd Moellmann + + * dispnew.c (update_text_area): Fix last change. + 2000-11-18 Gerd Moellmann * xdisp.c: Use BINDING_STACK_SIZE throughout. diff --git a/src/dispnew.c b/src/dispnew.c index 8e8f6c5b437..39d2408a4f7 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3996,7 +3996,7 @@ update_text_area (w, vpos) while (i < stop) { - int skip_equal_glyphs_p = 1; + int can_skip_p = 1; /* Skip over glyphs that both rows have in common. These don't have to be written. We can't skip if the last @@ -4013,38 +4013,42 @@ update_text_area (w, vpos) rif->get_glyph_overhangs (glyph, XFRAME (w->frame), &left, &right); - skip_equal_glyphs_p = right == 0; + can_skip_p = right == 0; } - - if (skip_equal_glyphs_p) - while (i < stop - && GLYPH_EQUAL_P (desired_glyph, current_glyph)) - { - x += desired_glyph->pixel_width; - ++desired_glyph, ++current_glyph, ++i; - } - - /* Consider the case that the current row contains "xxx ppp - ggg" in italic Courier font, and the desired row is "xxx - ggg". The character `p' has lbearing, `g' has not. The - loop above will stop in front of the first `p' in the - current row. If we would start writing glyphs there, we - wouldn't erase the lbearing of the `p'. The rest of the - lbearing problem is then taken care of by x_draw_glyphs. */ - if (overlapping_glyphs_p - && i > 0 - && i < current_row->used[TEXT_AREA] - && current_row->used[TEXT_AREA] != desired_row->used[TEXT_AREA]) + + if (can_skip_p) { - int left, right; - - rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame), - &left, &right); - while (left > 0 && i > 0) + while (i < stop + && GLYPH_EQUAL_P (desired_glyph, current_glyph)) { - --i, --desired_glyph, --current_glyph; - x -= desired_glyph->pixel_width; - left -= desired_glyph->pixel_width; + x += desired_glyph->pixel_width; + ++desired_glyph, ++current_glyph, ++i; + } + + /* Consider the case that the current row contains "xxx + ppp ggg" in italic Courier font, and the desired row + is "xxx ggg". The character `p' has lbearing, `g' + has not. The loop above will stop in front of the + first `p' in the current row. If we would start + writing glyphs there, we wouldn't erase the lbearing + of the `p'. The rest of the lbearing problem is then + taken care of by x_draw_glyphs. */ + if (overlapping_glyphs_p + && i > 0 + && i < current_row->used[TEXT_AREA] + && (current_row->used[TEXT_AREA] + != desired_row->used[TEXT_AREA])) + { + int left, right; + + rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame), + &left, &right); + while (left > 0 && i > 0) + { + --i, --desired_glyph, --current_glyph; + x -= desired_glyph->pixel_width; + left -= desired_glyph->pixel_width; + } } } @@ -4057,15 +4061,18 @@ update_text_area (w, vpos) int start_x = x, start_hpos = i; struct glyph *start = desired_glyph; int current_x = x; - + int skip_first_p = !can_skip_p; + /* Find the next glyph that's equal again. */ while (i < stop - && !GLYPH_EQUAL_P (desired_glyph, current_glyph) + && (skip_first_p + || !GLYPH_EQUAL_P (desired_glyph, current_glyph)) && x == current_x) { x += desired_glyph->pixel_width; current_x += current_glyph->pixel_width; ++desired_glyph, ++current_glyph, ++i; + skip_first_p = 0; } if (i == start_hpos || x != current_x) -- 2.39.5