diff options
| author | Richard M. Stallman | 1993-08-15 03:49:28 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-15 03:49:28 +0000 |
| commit | 2313b945f2383644aee802dac56e1b6dde84e7ea (patch) | |
| tree | b093e982715aabac1d5dca34dc7060257c7f490f /src | |
| parent | 9d11b9a1931cc6cc3ac7d7a94f7df9517b4960fb (diff) | |
| download | emacs-2313b945f2383644aee802dac56e1b6dde84e7ea.tar.gz emacs-2313b945f2383644aee802dac56e1b6dde84e7ea.zip | |
(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')
| -rw-r--r-- | src/intervals.c | 29 |
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) | |||
| 656 | 656 | ||
| 657 | i = find_interval (tree, position); | 657 | i = find_interval (tree, position); |
| 658 | 658 | ||
| 659 | /* If in middle of an interval which is not sticky either way, | ||
| 660 | we must not just give its properties to the insertion. | ||
| 661 | So split this interval at the insertion point. */ | ||
| 662 | if (! (position == i->position || eobp) | ||
| 663 | && END_NONSTICKY_P (i) | ||
| 664 | && ! FRONT_STICKY_P (i)) | ||
| 665 | { | ||
| 666 | temp = split_interval_right (i, position - i->position); | ||
| 667 | copy_properties (i, temp); | ||
| 668 | i = temp; | ||
| 669 | } | ||
| 670 | |||
| 659 | /* If we are positioned between intervals, check the stickiness of | 671 | /* If we are positioned between intervals, check the stickiness of |
| 660 | both of them. We have to do this too, if we are at BEG or Z. */ | 672 | both of them. We have to do this too, if we are at BEG or Z. */ |
| 661 | if (position == i->position || eobp) | 673 | if (position == i->position || eobp) |
| @@ -748,12 +760,13 @@ merge_properties_sticky (pleft, pright) | |||
| 748 | if (EQ (sym, Qrear_nonsticky) || EQ (sym, Qfront_sticky)) | 760 | if (EQ (sym, Qrear_nonsticky) || EQ (sym, Qfront_sticky)) |
| 749 | continue; | 761 | continue; |
| 750 | 762 | ||
| 751 | if (NILP (Fmemq (sym, lrear))) | 763 | if (CONSP (lrear) ? NILP (Fmemq (sym, lrear)) : NILP (lrear)) |
| 752 | { | 764 | { |
| 753 | /* rear-sticky is dominant, we needn't search in PRIGHT. */ | 765 | /* rear-sticky is dominant, we needn't search in PRIGHT. */ |
| 754 | 766 | ||
| 755 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail1)), props)); | 767 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail1)), props)); |
| 756 | if (! NILP (Fmemq (sym, lfront))) | 768 | if ((CONSP (lfront) || NILP (lfront)) |
| 769 | && ! NILP (Fmemq (sym, lfront))) | ||
| 757 | front = Fcons (sym, front); | 770 | front = Fcons (sym, front); |
| 758 | } | 771 | } |
| 759 | else | 772 | else |
| @@ -763,13 +776,15 @@ merge_properties_sticky (pleft, pright) | |||
| 763 | if (EQ (sym, Fcar (tail2))) | 776 | if (EQ (sym, Fcar (tail2))) |
| 764 | { | 777 | { |
| 765 | 778 | ||
| 766 | if (! NILP (Fmemq (sym, rfront))) | 779 | if (CONSP (rfront) |
| 780 | ? ! NILP (Fmemq (sym, rfront)) : ! NILP (rfront)) | ||
| 767 | { | 781 | { |
| 768 | /* Nonsticky at the left and sticky at the right, | 782 | /* Nonsticky at the left and sticky at the right, |
| 769 | so take the right one. */ | 783 | so take the right one. */ |
| 770 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props)); | 784 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props)); |
| 771 | front = Fcons (sym, front); | 785 | front = Fcons (sym, front); |
| 772 | if (! NILP (Fmemq (sym, rrear))) | 786 | if ((CONSP (rrear) || NILP (rrear)) |
| 787 | && ! NILP (Fmemq (sym, rrear))) | ||
| 773 | rear = Fcons (sym, rear); | 788 | rear = Fcons (sym, rear); |
| 774 | } | 789 | } |
| 775 | break; | 790 | break; |
| @@ -786,7 +801,8 @@ merge_properties_sticky (pleft, pright) | |||
| 786 | continue; | 801 | continue; |
| 787 | 802 | ||
| 788 | /* If it ain't sticky, we don't take it. */ | 803 | /* If it ain't sticky, we don't take it. */ |
| 789 | if (NILP (Fmemq (sym, rfront))) | 804 | if (CONSP (rfront) |
| 805 | ? NILP (Fmemq (sym, rfront)) : NILP (rfront)) | ||
| 790 | continue; | 806 | continue; |
| 791 | 807 | ||
| 792 | /* If sym is in PLEFT we already got it. */ | 808 | /* If sym is in PLEFT we already got it. */ |
| @@ -798,7 +814,8 @@ merge_properties_sticky (pleft, pright) | |||
| 798 | { | 814 | { |
| 799 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props)); | 815 | props = Fcons (sym, Fcons (Fcar (Fcdr (tail2)), props)); |
| 800 | front = Fcons (sym, front); | 816 | front = Fcons (sym, front); |
| 801 | if (! NILP (Fmemq (sym, rrear))) | 817 | if ((CONSP (rrear) || NILP (rrear)) |
| 818 | && ! NILP (Fmemq (sym, rrear))) | ||
| 802 | rear = Fcons (sym, rear); | 819 | rear = Fcons (sym, rear); |
| 803 | } | 820 | } |
| 804 | } | 821 | } |