summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-06-07 22:17:35 +0000
committerRichard M. Stallman <rms@gnu.org>1993-06-07 22:17:35 +0000
commitdaa5e28ff5d963c9e2c3abc63976460b2574ec5b (patch)
treee67de78640e269bbc3b4cc975cc277f1d30bc121 /src
parent93d35499193bf53af67613791d199d5f3e90f265 (diff)
downloademacs-daa5e28ff5d963c9e2c3abc63976460b2574ec5b.tar.gz
(Fadd_text_properties): Don't treat the initial
interval specially, aside from splitting off the part starting where we want to start changing things. (Fremove_text_properties): Likewise. For ending interval, split it left as in Fadd_text_properties. (Fset_text_properties): Don't set starting interval if it goes past END. Instead, split it left and set the left part.
Diffstat (limited to 'src')
-rw-r--r--src/textprop.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/src/textprop.c b/src/textprop.c
index e651cbf243b..89b882b511d 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -649,22 +649,10 @@ Return t if any property value actually changed, nil otherwise.")
unchanged = i;
i = split_interval_right (unchanged, s - unchanged->position + 1);
copy_properties (unchanged, i);
- if (LENGTH (i) > len)
- {
- i = split_interval_left (i, len + 1);
- copy_properties (unchanged, i);
- add_properties (properties, i, object);
- return Qt;
- }
-
- add_properties (properties, i, object);
- modified = 1;
- len -= LENGTH (i);
- i = next_interval (i);
}
}
- /* We are at the beginning of an interval, with len to scan */
+ /* We are at the beginning of interval I, with LEN chars to scan. */
for (;;)
{
if (i == 0)
@@ -742,15 +730,17 @@ is the string or buffer containing the text.")
{
unchanged = i;
i = split_interval_right (unchanged, s - unchanged->position + 1);
- set_properties (props, i, object);
if (LENGTH (i) > len)
{
- i = split_interval_right (i, len);
copy_properties (unchanged, i);
+ i = split_interval_left (i, len + 1);
+ set_properties (props, i, object);
return Qt;
}
+ set_properties (props, i, object);
+
if (LENGTH (i) == len)
return Qt;
@@ -828,25 +818,13 @@ Return t if any property was actually removed, nil otherwise.")
return Qnil;
len -= got;
}
- /* Remove the properties from this interval. If it's short
- enough, return, splitting it if it's too short. */
+ /* Split away the beginning of this interval; what we don't
+ want to modify. */
else
{
unchanged = i;
i = split_interval_right (unchanged, s - unchanged->position + 1);
copy_properties (unchanged, i);
- if (LENGTH (i) > len)
- {
- i = split_interval_left (i, len + 1);
- copy_properties (unchanged, i);
- remove_properties (props, i, object);
- return Qt;
- }
-
- remove_properties (props, i, object);
- modified = 1;
- len -= LENGTH (i);
- i = next_interval (i);
}
}
@@ -868,7 +846,8 @@ Return t if any property was actually removed, nil otherwise.")
}
/* i has the properties, and goes past the change limit */
- unchanged = split_interval_right (i, len + 1);
+ unchanged = i;
+ i = split_interval_left (i, len + 1);
copy_properties (unchanged, i);
remove_properties (props, i, object);
return Qt;