aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-09-14 12:10:53 +0000
committerRichard M. Stallman1993-09-14 12:10:53 +0000
commit7ea69158f0a00e84d31738ab6e9ea414c66b1410 (patch)
treeec66fa6f586aeb97b83b6a375aabc1797615b0f5 /src
parent0c28711271bb31257b95d85a6cd9bba42e32d11b (diff)
downloademacs-7ea69158f0a00e84d31738ab6e9ea414c66b1410.tar.gz
emacs-7ea69158f0a00e84d31738ab6e9ea414c66b1410.zip
(graft_intervals_into_buffer): New arg INHERIT.
Diffstat (limited to 'src')
-rw-r--r--src/intervals.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 75525594929..a6be24f1860 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1248,10 +1248,11 @@ make_new_interval (intervals, start, length)
1248 text... */ 1248 text... */
1249 1249
1250void 1250void
1251graft_intervals_into_buffer (source, position, buffer) 1251graft_intervals_into_buffer (source, position, buffer, inherit)
1252 INTERVAL source; 1252 INTERVAL source;
1253 int position; 1253 int position;
1254 struct buffer *buffer; 1254 struct buffer *buffer;
1255 int inherit;
1255{ 1256{
1256 register INTERVAL under, over, this, prev; 1257 register INTERVAL under, over, this, prev;
1257 register INTERVAL tree = buffer->intervals; 1258 register INTERVAL tree = buffer->intervals;
@@ -1284,23 +1285,21 @@ graft_intervals_into_buffer (source, position, buffer)
1284 tree = create_root_interval (buf); 1285 tree = create_root_interval (buf);
1285 } 1286 }
1286 } 1287 }
1287 else 1288 else if (TOTAL_LENGTH (tree) == TOTAL_LENGTH (source))
1288 if (TOTAL_LENGTH (tree) == TOTAL_LENGTH (source)) 1289 /* If the buffer contains only the new string, but
1289 /* If the buffer contains only the new string, but 1290 there was already some interval tree there, then it may be
1290 there was already some interval tree there, then it may be 1291 some zero length intervals. Eventually, do something clever
1291 some zero length intervals. Eventually, do something clever 1292 about inserting properly. For now, just waste the old intervals. */
1292 about inserting properly. For now, just waste the old intervals. */ 1293 {
1293 { 1294 buffer->intervals = reproduce_tree (source, tree->parent);
1294 buffer->intervals = reproduce_tree (source, tree->parent); 1295 /* Explicitly free the old tree here. */
1295 /* Explicitly free the old tree here. */
1296 1296
1297 return; 1297 return;
1298 } 1298 }
1299 else 1299 /* Paranoia -- the text has already been added, so this buffer
1300 /* Paranoia -- the text has already been added, so this buffer 1300 should be of non-zero length. */
1301 should be of non-zero length. */ 1301 else if (TOTAL_LENGTH (tree) == 0)
1302 if (TOTAL_LENGTH (tree) == 0) 1302 abort ();
1303 abort ();
1304 1303
1305 this = under = find_interval (tree, position); 1304 this = under = find_interval (tree, position);
1306 if (NULL_INTERVAL_P (under)) /* Paranoia */ 1305 if (NULL_INTERVAL_P (under)) /* Paranoia */
@@ -1345,7 +1344,7 @@ graft_intervals_into_buffer (source, position, buffer)
1345 else 1344 else
1346 this = under; 1345 this = under;
1347 copy_properties (over, this); 1346 copy_properties (over, this);
1348 if (MERGE_INSERTIONS (this)) 1347 if (inherit)
1349 merge_properties (over, this); 1348 merge_properties (over, this);
1350 else 1349 else
1351 copy_properties (over, this); 1350 copy_properties (over, this);