Mercurial > hg > xemacs-beta
comparison src/extents.c @ 98:0d2f883870bc r20-1b1
Import from CVS: tag r20-1b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:13:56 +0200 |
parents | dbb370e3c29e |
children | 4be1180a9e89 |
comparison
equal
deleted
inserted
replaced
97:498bf5da1c90 | 98:0d2f883870bc |
---|---|
2378 delete characters from a string. | 2378 delete characters from a string. |
2379 */ | 2379 */ |
2380 | 2380 |
2381 void | 2381 void |
2382 adjust_extents_for_deletion (Lisp_Object object, Bytind from, | 2382 adjust_extents_for_deletion (Lisp_Object object, Bytind from, |
2383 Bytind to, int gapsize, int numdel) | 2383 Bytind to, int gapsize, int numdel, |
2384 int movegapsize) | |
2384 { | 2385 { |
2385 struct adjust_extents_for_deletion_arg closure; | 2386 struct adjust_extents_for_deletion_arg closure; |
2386 int i; | 2387 int i; |
2388 Memind adjust_to = (Memind) (to + gapsize); | |
2389 Bytecount amount = - numdel - movegapsize; | |
2387 Memind oldsoe, newsoe; | 2390 Memind oldsoe, newsoe; |
2388 Stack_Of_Extents *soe = buffer_or_string_stack_of_extents (object); | 2391 Stack_Of_Extents *soe = buffer_or_string_stack_of_extents (object); |
2389 | 2392 |
2390 #ifdef ERROR_CHECK_EXTENTS | 2393 #ifdef ERROR_CHECK_EXTENTS |
2391 sledgehammer_extent_check (object); | 2394 sledgehammer_extent_check (object); |
2412 if (soe) | 2415 if (soe) |
2413 { | 2416 { |
2414 oldsoe = soe->pos; | 2417 oldsoe = soe->pos; |
2415 if (soe->pos >= 0) | 2418 if (soe->pos >= 0) |
2416 newsoe = do_marker_adjustment (soe->pos, | 2419 newsoe = do_marker_adjustment (soe->pos, |
2417 (Memind) (to + gapsize), | 2420 adjust_to, adjust_to, |
2418 (Memind) (to + gapsize), | 2421 amount); |
2419 - numdel - gapsize); | |
2420 else | 2422 else |
2421 newsoe = soe->pos; | 2423 newsoe = soe->pos; |
2422 } | 2424 } |
2423 | 2425 |
2424 for (i = 0; i < Dynarr_length (closure.list); i++) | 2426 for (i = 0; i < Dynarr_length (closure.list); i++) |
2425 { | 2427 { |
2426 EXTENT extent = Dynarr_at (closure.list, i); | 2428 EXTENT extent = Dynarr_at (closure.list, i); |
2427 Memind new_start, new_end; | 2429 Memind new_start = extent_start (extent); |
2430 Memind new_end = extent_end (extent); | |
2428 | 2431 |
2429 /* do_marker_adjustment() will not adjust values that should not be | 2432 /* do_marker_adjustment() will not adjust values that should not be |
2430 adjusted. We're passing the same funky arguments to | 2433 adjusted. We're passing the same funky arguments to |
2431 do_marker_adjustment() as buffer_delete_range() does. */ | 2434 do_marker_adjustment() as buffer_delete_range() does. */ |
2432 new_start = | 2435 new_start = |
2433 do_marker_adjustment (extent_start (extent), | 2436 do_marker_adjustment (new_start, |
2434 (Memind) (to + gapsize), | 2437 adjust_to, adjust_to, |
2435 (Memind) (to + gapsize), | 2438 amount); |
2436 - numdel - gapsize); | |
2437 new_end = | 2439 new_end = |
2438 do_marker_adjustment (extent_end (extent), | 2440 do_marker_adjustment (new_end, |
2439 (Memind) (to + gapsize), | 2441 adjust_to, adjust_to, |
2440 (Memind) (to + gapsize), | 2442 amount); |
2441 - numdel - gapsize); | |
2442 | 2443 |
2443 /* We need to be very careful here so that the SOE doesn't get | 2444 /* We need to be very careful here so that the SOE doesn't get |
2444 corrupted. We are shrinking extents out of the deleted region | 2445 corrupted. We are shrinking extents out of the deleted region |
2445 and simultaneously moving the SOE's pos out of the deleted | 2446 and simultaneously moving the SOE's pos out of the deleted |
2446 region, so the SOE should contain the same extents at the end | 2447 region, so the SOE should contain the same extents at the end |
5136 | 5137 |
5137 begin-glyph-layout The layout policy (one of `text', `whitespace', | 5138 begin-glyph-layout The layout policy (one of `text', `whitespace', |
5138 `inside-margin', or `outside-margin') of the extent's | 5139 `inside-margin', or `outside-margin') of the extent's |
5139 begin glyph. | 5140 begin glyph. |
5140 | 5141 |
5141 end-glyph-layout The layout policy of the extent's end glyph. */ | 5142 end-glyph-layout The layout policy of the extent's end glyph. |
5143 */ | |
5142 (extent, property, value)) | 5144 (extent, property, value)) |
5143 { | 5145 { |
5144 /* This function can GC if property is `keymap' */ | 5146 /* This function can GC if property is `keymap' */ |
5145 EXTENT e = decode_extent (extent, 0); | 5147 EXTENT e = decode_extent (extent, 0); |
5146 CHECK_SYMBOL (property); | 5148 CHECK_SYMBOL (property); |
6352 | 6354 |
6353 prop = Fextent_property (extent, Qtext_prop, Qnil); | 6355 prop = Fextent_property (extent, Qtext_prop, Qnil); |
6354 if (NILP (prop)) | 6356 if (NILP (prop)) |
6355 signal_simple_error ("internal error: no text-prop", extent); | 6357 signal_simple_error ("internal error: no text-prop", extent); |
6356 val = Fextent_property (extent, prop, Qnil); | 6358 val = Fextent_property (extent, prop, Qnil); |
6359 #if 0 | |
6360 /* removed by bill perry, 2/9/97 | |
6361 ** This little bit of code would not allow you to have a text property | |
6362 ** with a value of Qnil. This is bad bad bad. | |
6363 */ | |
6357 if (NILP (val)) | 6364 if (NILP (val)) |
6358 signal_simple_error_2 ("internal error: no text-prop", | 6365 signal_simple_error_2 ("internal error: no text-prop", |
6359 extent, prop); | 6366 extent, prop); |
6367 #endif | |
6360 Fput_text_property (from, to, prop, val, Qnil); | 6368 Fput_text_property (from, to, prop, val, Qnil); |
6361 return Qnil; /* important! */ | 6369 return Qnil; /* important! */ |
6362 } | 6370 } |
6363 | 6371 |
6364 /* This function could easily be written in Lisp but the C code wants | 6372 /* This function could easily be written in Lisp but the C code wants |