summaryrefslogtreecommitdiff
path: root/src/intervals.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-08-15 03:49:28 +0000
committerRichard M. Stallman <rms@gnu.org>1993-08-15 03:49:28 +0000
commit986dd2898f30802ef32e65740c9e56b2d40e8701 (patch)
treedcda48f1790f451022982f9136d98b506a7e66c9 /src/intervals.c
parentd6e0adf71cac59b4c3d3e124c17eb0b32b7ccfea (diff)
downloademacs-986dd2898f30802ef32e65740c9e56b2d40e8701.tar.gz
(adjust_intervals_for_insertion): If inserting in middle
of interval that is sticky in neither direction, don't copy props. (merge_properties_sticky): Handle non-list as front-sticky or rear-nonsticky property.
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 42f35942137..9d5333bdcbf 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -656,6 +656,18 @@ adjust_intervals_for_insertion (tree, position, length)
i = find_interval (tree, position);
+ /* If in middle of an interval which is not sticky either way,
+ we must not just give its properties to the insertion.
+ So split this interval at the insertion point. */
+ if (! (position == i->position || eobp)
+ && END_NONSTICKY_P (i)
+ && ! FRONT_STICKY_P (i))
+ {
+ temp = split_interval_right (i, position - i->position);
+ copy_properties (i, temp);
+ i = temp;
+ }
+
/* If we are positioned between intervals, check the stickiness of
both of them. We have to do this too, if we are at BEG or Z. */
if (position == i->position || eobp)
@@ -748,12 +760,13 @@ merge_properties_sticky (pleft, pright)
if (EQ (sym, Qrear_nonsticky) || EQ (sym, Qfront_sticky))
continue;
- if (NILP (Fmemq (sym, lrear)))
+ if (CONSP (lrear) ? NILP (Fmemq (sym, lrear)) : NILP (lrear))
{
/* rear-sticky is dominant, we needn't search in PRIGHT. */
props = Fcons (sym, Fcons (Fcar (Fcdr (tail1)), props));
- if (! NILP (Fmemq (sym, lfront)))
+ if ((CONSP (lfront) || NILP (lfront))
+ && ! NILP (Fmemq (sym, lfront)))
front = Fcons (sym, front);
}
else
@@ -763,13 +776,15 @@ merge_properties_sticky (pleft, pright)
if (EQ (sym, Fcar (tail2)))
{
- if (! NILP (Fmemq (sym, rfront)))
+ if (CONSP (rfront)
+ ? ! NILP (Fmemq (sym, rfront)) : ! NILP (rfront))
{
/* Nonsticky at the left and sticky at the right,
so take the right one. */
props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props));
front = Fcons (sym, front);
- if (! NILP (Fmemq (sym, rrear)))
+ if ((CONSP (rrear) || NILP (rrear))
+ && ! NILP (Fmemq (sym, rrear)))
rear = Fcons (sym, rear);
}
break;
@@ -786,7 +801,8 @@ merge_properties_sticky (pleft, pright)
continue;
/* If it ain't sticky, we don't take it. */
- if (NILP (Fmemq (sym, rfront)))
+ if (CONSP (rfront)
+ ? NILP (Fmemq (sym, rfront)) : NILP (rfront))
continue;
/* If sym is in PLEFT we already got it. */
@@ -798,7 +814,8 @@ merge_properties_sticky (pleft, pright)
{
props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props));
front = Fcons (sym, front);
- if (! NILP (Fmemq (sym, rrear)))
+ if ((CONSP (rrear) || NILP (rrear))
+ && ! NILP (Fmemq (sym, rrear)))
rear = Fcons (sym, rear);
}
}