comparison src/insdel.c @ 49600:23a1cea22d13

Trailing whitespace deleted.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 04 Feb 2003 14:56:31 +0000
parents b7e13d33cf41
children 54f0e48f9f7d d7ddb3e565de
comparison
equal deleted inserted replaced
49599:5ade352e8d1c 49600:23a1cea22d13
371 else if (charpos > from) 371 else if (charpos > from)
372 { 372 {
373 if (! m->insertion_type) 373 if (! m->insertion_type)
374 /* Normal markers will end up at the beginning of the 374 /* Normal markers will end up at the beginning of the
375 re-inserted text after undoing a deletion, and must be 375 re-inserted text after undoing a deletion, and must be
376 adjusted to move them to the correct place. */ 376 adjusted to move them to the correct place. */
377 record_marker_adjustment (marker, from - charpos); 377 record_marker_adjustment (marker, from - charpos);
378 else if (charpos < to) 378 else if (charpos < to)
379 /* Before-insertion markers will automatically move forward 379 /* Before-insertion markers will automatically move forward
380 upon re-inserting the deleted text, so we have to arrange 380 upon re-inserting the deleted text, so we have to arrange
381 for them to move backward to the correct position. */ 381 for them to move backward to the correct position. */
534 /* Don't allow a buffer size that won't fit in an int 534 /* Don't allow a buffer size that won't fit in an int
535 even if it will fit in a Lisp integer. 535 even if it will fit in a Lisp integer.
536 That won't work because so many places use `int'. 536 That won't work because so many places use `int'.
537 537
538 Make sure we don't introduce overflows in the calculation. */ 538 Make sure we don't introduce overflows in the calculation. */
539 539
540 if (Z_BYTE - BEG_BYTE + GAP_SIZE 540 if (Z_BYTE - BEG_BYTE + GAP_SIZE
541 >= (((EMACS_INT) 1 << (min (VALBITS, BITS_PER_INT) - 1)) - 1 541 >= (((EMACS_INT) 1 << (min (VALBITS, BITS_PER_INT) - 1)) - 1
542 - nbytes_added)) 542 - nbytes_added))
543 error ("Buffer exceeds maximum size"); 543 error ("Buffer exceeds maximum size");
544 544
988 register int nchars, nbytes; 988 register int nchars, nbytes;
989 int inherit, prepare, before_markers; 989 int inherit, prepare, before_markers;
990 { 990 {
991 if (nchars == 0) 991 if (nchars == 0)
992 return; 992 return;
993 993
994 if (NILP (current_buffer->enable_multibyte_characters)) 994 if (NILP (current_buffer->enable_multibyte_characters))
995 nchars = nbytes; 995 nchars = nbytes;
996 996
997 if (prepare) 997 if (prepare)
998 /* Do this before moving and increasing the gap, 998 /* Do this before moving and increasing the gap,
1171 1171
1172 intervals = STRING_INTERVALS (string); 1172 intervals = STRING_INTERVALS (string);
1173 /* Get the intervals for the part of the string we are inserting. */ 1173 /* Get the intervals for the part of the string we are inserting. */
1174 if (nbytes < SBYTES (string)) 1174 if (nbytes < SBYTES (string))
1175 intervals = copy_intervals (intervals, pos, nchars); 1175 intervals = copy_intervals (intervals, pos, nchars);
1176 1176
1177 /* Insert those intervals. */ 1177 /* Insert those intervals. */
1178 graft_intervals_into_buffer (intervals, PT, nchars, 1178 graft_intervals_into_buffer (intervals, PT, nchars,
1179 current_buffer, inherit); 1179 current_buffer, inherit);
1180 1180
1181 adjust_point (nchars, outgoing_nbytes); 1181 adjust_point (nchars, outgoing_nbytes);
1237 else 1237 else
1238 chunk = 0; 1238 chunk = 0;
1239 1239
1240 if (chunk < incoming_nbytes) 1240 if (chunk < incoming_nbytes)
1241 outgoing_after_gap 1241 outgoing_after_gap
1242 = count_size_as_multibyte (BUF_BYTE_ADDRESS (buf, 1242 = count_size_as_multibyte (BUF_BYTE_ADDRESS (buf,
1243 from_byte + chunk), 1243 from_byte + chunk),
1244 incoming_nbytes - chunk); 1244 incoming_nbytes - chunk);
1245 1245
1246 outgoing_nbytes = outgoing_before_gap + outgoing_after_gap; 1246 outgoing_nbytes = outgoing_before_gap + outgoing_after_gap;
1247 } 1247 }
1248 1248
1249 /* Make sure point-max won't overflow after this insertion. */ 1249 /* Make sure point-max won't overflow after this insertion. */
1250 XSETINT (temp, outgoing_nbytes + Z); 1250 XSETINT (temp, outgoing_nbytes + Z);
1251 if (outgoing_nbytes + Z != XINT (temp)) 1251 if (outgoing_nbytes + Z != XINT (temp))
1252 error ("Maximum buffer size exceeded"); 1252 error ("Maximum buffer size exceeded");
1253 1253
1327 { 1327 {
1328 if (buf == current_buffer && PT <= from) 1328 if (buf == current_buffer && PT <= from)
1329 from += nchars; 1329 from += nchars;
1330 intervals = copy_intervals (intervals, from, nchars); 1330 intervals = copy_intervals (intervals, from, nchars);
1331 } 1331 }
1332 1332
1333 /* Insert those intervals. */ 1333 /* Insert those intervals. */
1334 graft_intervals_into_buffer (intervals, PT, nchars, current_buffer, inherit); 1334 graft_intervals_into_buffer (intervals, PT, nchars, current_buffer, inherit);
1335 1335
1336 adjust_point (nchars, outgoing_nbytes); 1336 adjust_point (nchars, outgoing_nbytes);
1337 } 1337 }
2127 combine_after_change_buffer = Fcurrent_buffer (); 2127 combine_after_change_buffer = Fcurrent_buffer ();
2128 2128
2129 return; 2129 return;
2130 } 2130 }
2131 2131
2132 if (!NILP (combine_after_change_list)) 2132 if (!NILP (combine_after_change_list))
2133 Fcombine_after_change_execute (); 2133 Fcombine_after_change_execute ();
2134 2134
2135 if (!NILP (Vafter_change_functions)) 2135 if (!NILP (Vafter_change_functions))
2136 { 2136 {
2137 Lisp_Object args[4]; 2137 Lisp_Object args[4];
2258 2258
2259 /* Get the current start and end positions of the range 2259 /* Get the current start and end positions of the range
2260 that was changed. */ 2260 that was changed. */
2261 begpos = BEG + beg; 2261 begpos = BEG + beg;
2262 endpos = Z - end; 2262 endpos = Z - end;
2263 2263
2264 /* We are about to handle these, so discard them. */ 2264 /* We are about to handle these, so discard them. */
2265 combine_after_change_list = Qnil; 2265 combine_after_change_list = Qnil;
2266 2266
2267 /* Now run the after-change functions for real. 2267 /* Now run the after-change functions for real.
2268 Turn off the flag that defers them. */ 2268 Turn off the flag that defers them. */