131 |
struct region_cache * |
struct region_cache * |
132 |
new_region_cache () |
new_region_cache () |
133 |
{ |
{ |
134 |
struct region_cache *c |
struct region_cache *c |
135 |
= (struct region_cache *) xmalloc (sizeof (struct region_cache)); |
= (struct region_cache *) xmalloc (sizeof (struct region_cache)); |
136 |
|
|
137 |
c->gap_start = 0; |
c->gap_start = 0; |
385 |
|
|
386 |
c->cache_len -= len; |
c->cache_len -= len; |
387 |
} |
} |
388 |
|
|
389 |
|
|
390 |
|
|
391 |
/* Set the value for a region. */ |
/* Set the value for a region. */ |
407 |
both the locations of real characters in the buffer. */ |
both the locations of real characters in the buffer. */ |
408 |
if (start == end) |
if (start == end) |
409 |
return; |
return; |
410 |
|
|
411 |
{ |
{ |
412 |
/* We need to make sure that there are no boundaries in the area |
/* We need to make sure that there are no boundaries in the area |
413 |
between start to end; the whole area will have the same value, |
between start to end; the whole area will have the same value, |
414 |
so those boundaries will not be necessary. |
so those boundaries will not be necessary. |
415 |
|
|
416 |
Let start_ix be the cache index of the boundary governing the |
Let start_ix be the cache index of the boundary governing the |
417 |
first character of start..end, and let end_ix be the cache |
first character of start..end, and let end_ix be the cache |
418 |
index of the earliest boundary after the last character in |
index of the earliest boundary after the last character in |
456 |
start_ix++; |
start_ix++; |
457 |
} |
} |
458 |
} |
} |
459 |
|
|
460 |
/* This is equivalent to letting end_ix float (like a buffer |
/* This is equivalent to letting end_ix float (like a buffer |
461 |
marker does) with the insertions and deletions we may have |
marker does) with the insertions and deletions we may have |
462 |
done. */ |
done. */ |
553 |
} |
} |
554 |
|
|
555 |
|
|
556 |
/* Clean out any cache entries applying to the modified region, and |
/* Clean out any cache entries applying to the modified region, and |
557 |
make the positions of the remaining entries accurate again. |
make the positions of the remaining entries accurate again. |
558 |
|
|
559 |
After calling this function, the mess described in the comment in |
After calling this function, the mess described in the comment in |
606 |
(which will give the modified region the same size in the cache |
(which will give the modified region the same size in the cache |
607 |
as it has in the buffer), and then invalidate the modified |
as it has in the buffer), and then invalidate the modified |
608 |
region. */ |
region. */ |
609 |
if (c->buffer_beg + c->beg_unchanged |
if (c->buffer_beg + c->beg_unchanged |
610 |
== c->buffer_end - c->end_unchanged) |
== c->buffer_end - c->end_unchanged) |
611 |
{ |
{ |
612 |
/* Move the gap so that all the boundaries in the unchanged head |
/* Move the gap so that all the boundaries in the unchanged head |
721 |
/* Interface: using the cache. */ |
/* Interface: using the cache. */ |
722 |
|
|
723 |
/* Return true if the text immediately after POS in BUF is known, for |
/* Return true if the text immediately after POS in BUF is known, for |
724 |
the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest |
the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest |
725 |
position after POS where the knownness changes. */ |
position after POS where the knownness changes. */ |
726 |
int |
int |
727 |
region_cache_forward (buf, c, pos, next) |
region_cache_forward (buf, c, pos, next) |