summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 8b4b2f7a..0d604f3d 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1760,28 +1760,34 @@ pango_attr_list_update (PangoAttrList *list,
continue;
}
- if (attr->start_index >= pos &&
- attr->start_index < pos + remove)
- {
- attr->start_index = pos + add;
- }
- else if (attr->start_index >= pos + remove)
+ if (attr->start_index != PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING)
{
- attr->start_index += add - remove;
+ if (attr->start_index >= pos &&
+ attr->start_index < pos + remove)
+ {
+ attr->start_index = pos + add;
+ }
+ else if (attr->start_index >= pos + remove)
+ {
+ attr->start_index += add - remove;
+ }
}
- if (attr->end_index >= pos &&
- attr->end_index < pos + remove)
- {
- attr->end_index = pos;
- }
- else if (attr->end_index >= pos + remove)
+ if (attr->end_index != PANGO_ATTR_INDEX_TO_TEXT_END)
{
- if (add > remove &&
- G_MAXUINT - attr->end_index < add - remove)
- attr->end_index = G_MAXUINT;
- else
- attr->end_index += add - remove;
+ if (attr->end_index >= pos &&
+ attr->end_index < pos + remove)
+ {
+ attr->end_index = pos;
+ }
+ else if (attr->end_index >= pos + remove)
+ {
+ if (add > remove &&
+ G_MAXUINT - attr->end_index < add - remove)
+ attr->end_index = G_MAXUINT;
+ else
+ attr->end_index += add - remove;
+ }
}
}
}