Mercurial > emacs
comparison src/insdel.c @ 85016:c7d378d22b24
(adjust_markers_for_insert): Generalize assertion checks.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 02 Oct 2007 21:07:15 +0000 |
parents | 85a3f55b5fdf |
children | 107ccd98fa12 bdb3fe0ba9fa |
comparison
equal
deleted
inserted
replaced
85015:695c195058e7 | 85016:c7d378d22b24 |
---|---|
413 int nchars = to - from; | 413 int nchars = to - from; |
414 int nbytes = to_byte - from_byte; | 414 int nbytes = to_byte - from_byte; |
415 | 415 |
416 for (m = BUF_MARKERS (current_buffer); m; m = m->next) | 416 for (m = BUF_MARKERS (current_buffer); m; m = m->next) |
417 { | 417 { |
418 /* In a single-byte buffer, a marker's two positions must be | 418 eassert (m->bytepos >= m->charpos |
419 equal. */ | 419 && m->bytepos - m->charpos <= Z_BYTE - Z); |
420 if (Z == Z_BYTE) | |
421 { | |
422 if (m->charpos != m->bytepos) | |
423 abort (); | |
424 } | |
425 | 420 |
426 if (m->bytepos == from_byte) | 421 if (m->bytepos == from_byte) |
427 { | 422 { |
428 if (m->insertion_type || before_markers) | 423 if (m->insertion_type || before_markers) |
429 { | 424 { |
466 { | 461 { |
467 BUF_PT (current_buffer) += nchars; | 462 BUF_PT (current_buffer) += nchars; |
468 BUF_PT_BYTE (current_buffer) += nbytes; | 463 BUF_PT_BYTE (current_buffer) += nbytes; |
469 | 464 |
470 /* In a single-byte buffer, the two positions must be equal. */ | 465 /* In a single-byte buffer, the two positions must be equal. */ |
471 if (ZV == ZV_BYTE | 466 eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV); |
472 && PT != PT_BYTE) | |
473 abort (); | |
474 } | 467 } |
475 | 468 |
476 /* Adjust markers for a replacement of a text at FROM (FROM_BYTE) of | 469 /* Adjust markers for a replacement of a text at FROM (FROM_BYTE) of |
477 length OLD_CHARS (OLD_BYTES) to a new text of length NEW_CHARS | 470 length OLD_CHARS (OLD_BYTES) to a new text of length NEW_CHARS |
478 (NEW_BYTES). It is assumed that OLD_CHARS > 0, i.e., this is not | 471 (NEW_BYTES). It is assumed that OLD_CHARS > 0, i.e., this is not |