comparison src/intervals.c @ 5760:ffe89784cef2

(merge_properties_sticky): Preserve original order of properties.
author Karl Heuer <kwzh@gnu.org>
date Thu, 03 Feb 1994 18:54:04 +0000
parents ceed2e32b303
children ab11e2af95ef
comparison
equal deleted inserted replaced
5759:e4bd64404a43 5760:ffe89784cef2
302 /* Make A point to c */ 302 /* Make A point to c */
303 interval->left = i; 303 interval->left = i;
304 if (! NULL_INTERVAL_P (i)) 304 if (! NULL_INTERVAL_P (i))
305 i->parent = interval; 305 i->parent = interval;
306 306
307 /* A's total length is decreased by the length of B and it's left child. */ 307 /* A's total length is decreased by the length of B and its left child. */
308 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); 308 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
309 309
310 /* B must have the same total length of A. */ 310 /* B must have the same total length of A. */
311 B->total_length = old_total; 311 B->total_length = old_total;
312 312
346 /* Make A point to c */ 346 /* Make A point to c */
347 interval->right = i; 347 interval->right = i;
348 if (! NULL_INTERVAL_P (i)) 348 if (! NULL_INTERVAL_P (i))
349 i->parent = interval; 349 i->parent = interval;
350 350
351 /* A's total length is decreased by the length of B and it's right child. */ 351 /* A's total length is decreased by the length of B and its right child. */
352 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); 352 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
353 353
354 /* B must have the same total length of A. */ 354 /* B must have the same total length of A. */
355 B->total_length = old_total; 355 B->total_length = old_total;
356 356
724 } 724 }
725 #endif 725 #endif
726 726
727 /* Effect an adjustment corresponding to the addition of LENGTH characters 727 /* Effect an adjustment corresponding to the addition of LENGTH characters
728 of text. Do this by finding the interval containing POSITION in the 728 of text. Do this by finding the interval containing POSITION in the
729 interval tree TREE, and then adjusting all of it's ancestors by adding 729 interval tree TREE, and then adjusting all of its ancestors by adding
730 LENGTH to them. 730 LENGTH to them.
731 731
732 If POSITION is the first character of an interval, meaning that point 732 If POSITION is the first character of an interval, meaning that point
733 is actually between the two intervals, make the new text belong to 733 is actually between the two intervals, make the new text belong to
734 the interval which is "sticky". 734 the interval which is "sticky".
925 if ((CONSP (rrear) || NILP (rrear)) 925 if ((CONSP (rrear) || NILP (rrear))
926 && ! NILP (Fmemq (sym, rrear))) 926 && ! NILP (Fmemq (sym, rrear)))
927 rear = Fcons (sym, rear); 927 rear = Fcons (sym, rear);
928 } 928 }
929 } 929 }
930 props = Fnreverse (props);
930 if (! NILP (front)) 931 if (! NILP (front))
931 props = Fcons (Qfront_sticky, Fcons (front, props)); 932 props = Fcons (Qfront_sticky, Fcons (Fnreverse (front), props));
932 if (! NILP (rear)) 933 if (! NILP (rear))
933 props = Fcons (Qrear_nonsticky, Fcons (rear, props)); 934 props = Fcons (Qrear_nonsticky, Fcons (Fnreverse (rear), props));
934 return props; 935 return props;
935
936 } 936 }
937 937
938 938
939 /* Delete an node I from its interval tree by merging its subtrees 939 /* Delete an node I from its interval tree by merging its subtrees
940 into one subtree which is then returned. Caller is responsible for 940 into one subtree which is then returned. Caller is responsible for