summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-05-24 01:41:01 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-05-24 01:41:01 +0000
commit3dab00ded913500cf5953d33dca469ba4fb0ac81 (patch)
tree0198b538263298dd09d90bad5cbcc59a52477672 /pango/pango-attributes.c
parentc40a071b47aff7f50cdf48fc94b63baa5f1c82f6 (diff)
parent6e363555a5ed76756a5bc8eb4914dc2e4af9c3b5 (diff)
downloadpango-3dab00ded913500cf5953d33dca469ba4fb0ac81.tar.gz
Merge branch 'more-attr-update-fixes' into 'master'
Explicitly preserve unlimited attributes See merge request GNOME/pango!338
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;
+ }
}
}
}