[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace-match's problem
From: |
Richard Stallman |
Subject: |
Re: replace-match's problem |
Date: |
Sun, 21 Sep 2003 18:34:30 -0400 |
Does this fix it?
*** intervals.c.~1.124.~ Thu Sep 11 09:51:23 2003
--- intervals.c Sun Sep 21 15:48:02 2003
***************
*** 1712,1717 ****
--- 1712,1718 ----
{
register INTERVAL under, over, this, prev;
register INTERVAL tree;
+ int over_used;
tree = BUF_INTERVALS (buffer);
***************
*** 1814,1821 ****
--- 1815,1828 ----
adjust_intervals_for_insertion, so stickiness has
already been taken care of. */
+ /* OVER is the interval we are copying from next.
+ OVER_USED says how many characters' worth of OVER
+ have already been copied into target intervals.
+ UNDER is the next interval in the target. */
+ over_used = 0;
while (! NULL_INTERVAL_P (over))
{
+ /* If UNDER is longer than OVER, split it. */
if (LENGTH (over) < LENGTH (under))
{
this = split_interval_left (under, LENGTH (over));
***************
*** 1823,1834 ****
}
else
this = under;
! copy_properties (over, this);
if (inherit)
merge_properties (over, this);
else
copy_properties (over, this);
! over = next_interval (over);
}
if (! NULL_INTERVAL_P (BUF_INTERVALS (buffer)))
--- 1830,1856 ----
}
else
this = under;
!
! /* THIS is now the interval to copy or merge into.
! OVER covers all of it. */
if (inherit)
merge_properties (over, this);
else
copy_properties (over, this);
!
! /* If THIS and OVER end at the same place,
! advance OVER to a new source interval. */
! if (LENGTH (this) == LENGTH (over) - over_used)
! {
! over = next_interval (over);
! over_used = 0;
! }
! else
! /* Otherwise just record that more of OVER has been used. */
! over_used += LENGTH (this);
!
! /* Always advance to a new target interval. */
! under = next_interval (this);
}
if (! NULL_INTERVAL_P (BUF_INTERVALS (buffer)))