summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c2
-rw-r--r--src/intervals.h2
-rw-r--r--src/textprop.c13
3 files changed, 10 insertions, 7 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 0c01c748d22..73f024409b1 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4631,7 +4631,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
len = make_number (SCHARS (args[i]));
Lisp_Object new_len = make_number (info[i].end - info[i].start);
props = text_property_list (args[i], make_number (0), len, Qnil);
- props = extend_property_ranges (props, new_len);
+ props = extend_property_ranges (props, len, new_len);
/* If successive arguments have properties, be sure that
the value of `composition' property be the copy. */
if (1 < i && info[i - 1].end)
diff --git a/src/intervals.h b/src/intervals.h
index 6a5a4129abc..9a38d849b88 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -285,7 +285,7 @@ extern void set_text_properties_1 (Lisp_Object, Lisp_Object,
Lisp_Object text_property_list (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object);
void add_text_properties_from_list (Lisp_Object, Lisp_Object, Lisp_Object);
-Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object);
+Lisp_Object extend_property_ranges (Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object get_char_property_and_overlay (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object*);
extern int text_property_stickiness (Lisp_Object prop, Lisp_Object pos,
diff --git a/src/textprop.c b/src/textprop.c
index aabd5671e76..7af8c698736 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -2043,18 +2043,19 @@ add_text_properties_from_list (Lisp_Object object, Lisp_Object list, Lisp_Object
end-points to NEW_END. */
Lisp_Object
-extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
+extend_property_ranges (Lisp_Object list, Lisp_Object old_end, Lisp_Object new_end)
{
Lisp_Object prev = Qnil, head = list;
ptrdiff_t max = XINT (new_end);
for (; CONSP (list); prev = list, list = XCDR (list))
{
- Lisp_Object item, beg, end;
+ Lisp_Object item, beg;
+ ptrdiff_t end;
item = XCAR (list);
beg = XCAR (item);
- end = XCAR (XCDR (item));
+ end = XINT (XCAR (XCDR (item)));
if (XINT (beg) >= max)
{
@@ -2065,12 +2066,14 @@ extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
else
XSETCDR (prev, XCDR (list));
}
- else if (XINT (end) != max)
+ else if ((end == XINT (old_end) && end != max)
+ || end > max)
{
/* Either the end-point is past the end of the new string,
and we need to discard the properties past the new end,
or the caller is extending the property range, and we
- should update the end-point to reflect that. */
+ should update all end-points that are on the old end of
+ the range to reflect that. */
XSETCAR (XCDR (item), new_end);
}
}