Mercurial > emacs
comparison src/textprop.c @ 3553:5f9688c0b704
(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.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Jun 1993 22:17:35 +0000 |
parents | 789c11177579 |
children | 507f64624555 |
comparison
equal
deleted
inserted
replaced
3552:84fded047f22 | 3553:5f9688c0b704 |
---|---|
647 else | 647 else |
648 { | 648 { |
649 unchanged = i; | 649 unchanged = i; |
650 i = split_interval_right (unchanged, s - unchanged->position + 1); | 650 i = split_interval_right (unchanged, s - unchanged->position + 1); |
651 copy_properties (unchanged, i); | 651 copy_properties (unchanged, i); |
652 if (LENGTH (i) > len) | 652 } |
653 { | 653 } |
654 i = split_interval_left (i, len + 1); | 654 |
655 copy_properties (unchanged, i); | 655 /* We are at the beginning of interval I, with LEN chars to scan. */ |
656 add_properties (properties, i, object); | |
657 return Qt; | |
658 } | |
659 | |
660 add_properties (properties, i, object); | |
661 modified = 1; | |
662 len -= LENGTH (i); | |
663 i = next_interval (i); | |
664 } | |
665 } | |
666 | |
667 /* We are at the beginning of an interval, with len to scan */ | |
668 for (;;) | 656 for (;;) |
669 { | 657 { |
670 if (i == 0) | 658 if (i == 0) |
671 abort (); | 659 abort (); |
672 | 660 |
740 | 728 |
741 if (i->position != s) | 729 if (i->position != s) |
742 { | 730 { |
743 unchanged = i; | 731 unchanged = i; |
744 i = split_interval_right (unchanged, s - unchanged->position + 1); | 732 i = split_interval_right (unchanged, s - unchanged->position + 1); |
733 | |
734 if (LENGTH (i) > len) | |
735 { | |
736 copy_properties (unchanged, i); | |
737 i = split_interval_left (i, len + 1); | |
738 set_properties (props, i, object); | |
739 return Qt; | |
740 } | |
741 | |
745 set_properties (props, i, object); | 742 set_properties (props, i, object); |
746 | |
747 if (LENGTH (i) > len) | |
748 { | |
749 i = split_interval_right (i, len); | |
750 copy_properties (unchanged, i); | |
751 return Qt; | |
752 } | |
753 | 743 |
754 if (LENGTH (i) == len) | 744 if (LENGTH (i) == len) |
755 return Qt; | 745 return Qt; |
756 | 746 |
757 prev_changed = i; | 747 prev_changed = i; |
826 int got = (LENGTH (i) - (s - i->position)); | 816 int got = (LENGTH (i) - (s - i->position)); |
827 if (got >= len) | 817 if (got >= len) |
828 return Qnil; | 818 return Qnil; |
829 len -= got; | 819 len -= got; |
830 } | 820 } |
831 /* Remove the properties from this interval. If it's short | 821 /* Split away the beginning of this interval; what we don't |
832 enough, return, splitting it if it's too short. */ | 822 want to modify. */ |
833 else | 823 else |
834 { | 824 { |
835 unchanged = i; | 825 unchanged = i; |
836 i = split_interval_right (unchanged, s - unchanged->position + 1); | 826 i = split_interval_right (unchanged, s - unchanged->position + 1); |
837 copy_properties (unchanged, i); | 827 copy_properties (unchanged, i); |
838 if (LENGTH (i) > len) | |
839 { | |
840 i = split_interval_left (i, len + 1); | |
841 copy_properties (unchanged, i); | |
842 remove_properties (props, i, object); | |
843 return Qt; | |
844 } | |
845 | |
846 remove_properties (props, i, object); | |
847 modified = 1; | |
848 len -= LENGTH (i); | |
849 i = next_interval (i); | |
850 } | 828 } |
851 } | 829 } |
852 | 830 |
853 /* We are at the beginning of an interval, with len to scan */ | 831 /* We are at the beginning of an interval, with len to scan */ |
854 for (;;) | 832 for (;;) |
866 remove_properties (props, i, object); | 844 remove_properties (props, i, object); |
867 return Qt; | 845 return Qt; |
868 } | 846 } |
869 | 847 |
870 /* i has the properties, and goes past the change limit */ | 848 /* i has the properties, and goes past the change limit */ |
871 unchanged = split_interval_right (i, len + 1); | 849 unchanged = i; |
850 i = split_interval_left (i, len + 1); | |
872 copy_properties (unchanged, i); | 851 copy_properties (unchanged, i); |
873 remove_properties (props, i, object); | 852 remove_properties (props, i, object); |
874 return Qt; | 853 return Qt; |
875 } | 854 } |
876 | 855 |