Mercurial > hg > xemacs-beta
comparison src/extents.c @ 468:20ae8821c23d
[xemacs-hg @ 2001-04-13 09:11:17 by michaels]
The Great Trunk Move from release-21-2.
author | michaels |
---|---|
date | Fri, 13 Apr 2001 09:11:46 +0000 |
parents | c33ae14dd6d0 |
children | 183866b06e0b |
comparison
equal
deleted
inserted
replaced
467:13d500863631 | 468:20ae8821c23d |
---|---|
3841 return Fdetach_extent (extent); | 3841 return Fdetach_extent (extent); |
3842 | 3842 |
3843 get_buffer_or_string_range_byte (buffer_or_string, start, end, &s, &e, | 3843 get_buffer_or_string_range_byte (buffer_or_string, start, end, &s, &e, |
3844 GB_ALLOW_PAST_ACCESSIBLE); | 3844 GB_ALLOW_PAST_ACCESSIBLE); |
3845 | 3845 |
3846 buffer_or_string_extent_info_force (buffer_or_string); | |
3846 set_extent_endpoints (ext, s, e, buffer_or_string); | 3847 set_extent_endpoints (ext, s, e, buffer_or_string); |
3847 return extent; | 3848 return extent; |
3848 } | 3849 } |
3849 | 3850 |
3850 | 3851 |
4572 extent_end (extent) < indice + closure->length) | 4573 extent_end (extent) < indice + closure->length) |
4573 abort (); | 4574 abort (); |
4574 #endif | 4575 #endif |
4575 | 4576 |
4576 /* The extent-adjustment code adjusted the extent's endpoints as if | 4577 /* The extent-adjustment code adjusted the extent's endpoints as if |
4577 they were markers -- endpoints at the gap (i.e. the insertion | 4578 all extents were closed-open -- endpoints at the insertion point |
4578 point) go to the left of the insertion point, which is correct | 4579 remain unchanged. We need to fix the other kinds of extents: |
4579 for [) extents. We need to fix the other kinds of extents. | 4580 |
4580 | 4581 1. Start position of start-open extents needs to be moved. |
4581 Note that both conditions below will hold for zero-length (] | 4582 |
4582 extents at the gap. Zero-length () extents would get adjusted | 4583 2. End position of end-closed extents needs to be moved. |
4583 such that their start is greater than their end; we treat them | 4584 |
4584 as [) extents. This is unfortunately an inelegant part of the | 4585 Note that both conditions hold for zero-length (] extents at the |
4585 extent model, but there is no way around it. */ | 4586 insertion point. But under these rules, zero-length () extents |
4587 would get adjusted such that their start is greater than their | |
4588 end; instead of allowing that, we treat them as [) extents by | |
4589 modifying condition #1 to not fire nothing when dealing with a | |
4590 zero-length open-open extent. | |
4591 | |
4592 Existence of zero-length open-open extents is unfortunately an | |
4593 inelegant part of the extent model, but there is no way around | |
4594 it. */ | |
4586 | 4595 |
4587 { | 4596 { |
4588 Memind new_start, new_end; | 4597 Memind new_start = extent_start (extent); |
4589 | 4598 Memind new_end = extent_end (extent); |
4590 new_start = extent_start (extent); | 4599 |
4591 new_end = extent_end (extent); | 4600 if (indice == extent_start (extent) && extent_start_open_p (extent) |
4592 if (indice == extent_start (extent) && extent_start_open_p (extent) && | 4601 /* zero-length () extents are exempt; see comment above. */ |
4593 /* coerce zero-length () extents to [) */ | 4602 && !(new_start == new_end && extent_end_open_p (extent)) |
4594 new_start != new_end) | 4603 ) |
4595 new_start += closure->length; | 4604 new_start += closure->length; |
4596 if (indice == extent_end (extent) && !extent_end_open_p (extent)) | 4605 if (indice == extent_end (extent) && !extent_end_open_p (extent)) |
4597 new_end += closure->length; | 4606 new_end += closure->length; |
4607 | |
4598 set_extent_endpoints_1 (extent, new_start, new_end); | 4608 set_extent_endpoints_1 (extent, new_start, new_end); |
4599 } | 4609 } |
4600 | 4610 |
4601 return 0; | 4611 return 0; |
4602 } | 4612 } |