diff options
| author | Richard M. Stallman | 1993-06-07 22:17:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-07 22:17:35 +0000 |
| commit | daa5e28ff5d963c9e2c3abc63976460b2574ec5b (patch) | |
| tree | e67de78640e269bbc3b4cc975cc277f1d30bc121 /src/textprop.c | |
| parent | 93d35499193bf53af67613791d199d5f3e90f265 (diff) | |
| download | emacs-daa5e28ff5d963c9e2c3abc63976460b2574ec5b.tar.gz emacs-daa5e28ff5d963c9e2c3abc63976460b2574ec5b.zip | |
(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/textprop.c')
| -rw-r--r-- | src/textprop.c | 39 |
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.") | |||
| 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) | ||
| 653 | { | ||
| 654 | i = split_interval_left (i, len + 1); | ||
| 655 | copy_properties (unchanged, i); | ||
| 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 | } | 652 | } |
| 665 | } | 653 | } |
| 666 | 654 | ||
| 667 | /* We are at the beginning of an interval, with len to scan */ | 655 | /* We are at the beginning of interval I, with LEN chars to scan. */ |
| 668 | for (;;) | 656 | for (;;) |
| 669 | { | 657 | { |
| 670 | if (i == 0) | 658 | if (i == 0) |
| @@ -742,15 +730,17 @@ is the string or buffer containing the text.") | |||
| 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); |
| 745 | set_properties (props, i, object); | ||
| 746 | 733 | ||
| 747 | if (LENGTH (i) > len) | 734 | if (LENGTH (i) > len) |
| 748 | { | 735 | { |
| 749 | i = split_interval_right (i, len); | ||
| 750 | copy_properties (unchanged, i); | 736 | copy_properties (unchanged, i); |
| 737 | i = split_interval_left (i, len + 1); | ||
| 738 | set_properties (props, i, object); | ||
| 751 | return Qt; | 739 | return Qt; |
| 752 | } | 740 | } |
| 753 | 741 | ||
| 742 | set_properties (props, i, object); | ||
| 743 | |||
| 754 | if (LENGTH (i) == len) | 744 | if (LENGTH (i) == len) |
| 755 | return Qt; | 745 | return Qt; |
| 756 | 746 | ||
| @@ -828,25 +818,13 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 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 | ||
| @@ -868,7 +846,8 @@ Return t if any property was actually removed, nil otherwise.") | |||
| 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; |