From 3463c0d118da131b01179fc432e04a4400fc767b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 8 Aug 2015 16:12:24 +0200 Subject: Fix pango_glyph_item_iter_prev() around last cluster It was combining the last two clusters. Ouch! Test added already. Passes now. --- pango/pango-glyph-item.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c index 1d4ff8ea..6954ed86 100644 --- a/pango/pango-glyph-item.c +++ b/pango/pango-glyph-item.c @@ -359,8 +359,6 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) cluster = glyphs->log_clusters[glyph_index - 1]; while (TRUE) { - glyph_index--; - if (glyph_index == 0) { iter->start_index = item->offset; @@ -368,6 +366,8 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) break; } + glyph_index--; + if (glyphs->log_clusters[glyph_index] != cluster) { glyph_index++; @@ -383,8 +383,6 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) cluster = glyphs->log_clusters[glyph_index + 1]; while (TRUE) { - glyph_index++; - if (glyph_index == glyphs->num_glyphs - 1) { iter->start_index = item->offset; @@ -392,6 +390,8 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter) break; } + glyph_index++; + if (glyphs->log_clusters[glyph_index] != cluster) { glyph_index--; -- cgit v1.2.1