comparison src/insdel.c @ 23053:09d1521f9984

(replace_range): Rename NOMARKERS arg to MARKERS.
author Richard M. Stallman <rms@gnu.org>
date Tue, 18 Aug 1998 07:00:00 +0000
parents 2e93e3302328
children 48fb93ba8b10
comparison
equal deleted inserted replaced
23052:39b3f4c74b93 23053:09d1521f9984
1663 from the surrounding non-deleted text. */ 1663 from the surrounding non-deleted text. */
1664 1664
1665 /* Note that this does not yet handle markers quite right. 1665 /* Note that this does not yet handle markers quite right.
1666 Also it needs to record a single undo-entry that does a replacement 1666 Also it needs to record a single undo-entry that does a replacement
1667 rather than a separate delete and insert. 1667 rather than a separate delete and insert.
1668 That way, undo will also handle markers properly. */ 1668 That way, undo will also handle markers properly.
1669 1669
1670 void 1670 But if MARKERS is 0, don't relocate markers. */
1671 replace_range (from, to, new, prepare, inherit, nomarkers) 1671
1672 void
1673 replace_range (from, to, new, prepare, inherit, markers)
1672 Lisp_Object new; 1674 Lisp_Object new;
1673 int from, to, prepare, inherit, nomarkers; 1675 int from, to, prepare, inherit, markers;
1674 { 1676 {
1675 int inschars = XSTRING (new)->size; 1677 int inschars = XSTRING (new)->size;
1676 int insbytes = STRING_BYTES (XSTRING (new)); 1678 int insbytes = STRING_BYTES (XSTRING (new));
1677 int from_byte, to_byte; 1679 int from_byte, to_byte;
1678 int nbytes_del, nchars_del; 1680 int nbytes_del, nchars_del;
1738 deletion = Qnil; 1740 deletion = Qnil;
1739 1741
1740 if (! EQ (current_buffer->undo_list, Qt)) 1742 if (! EQ (current_buffer->undo_list, Qt))
1741 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1); 1743 deletion = make_buffer_string_both (from, from_byte, to, to_byte, 1);
1742 1744
1743 if (nomarkers) 1745 if (markers)
1744 /* Relocate all markers pointing into the new, larger gap 1746 /* Relocate all markers pointing into the new, larger gap
1745 to point at the end of the text before the gap. 1747 to point at the end of the text before the gap.
1746 Do this before recording the deletion, 1748 Do this before recording the deletion,
1747 so that undo handles this after reinserting the text. */ 1749 so that undo handles this after reinserting the text. */
1748 adjust_markers_for_delete (from, from_byte, to, to_byte); 1750 adjust_markers_for_delete (from, from_byte, to, to_byte);
1847 1849
1848 /* Adjust the overlay center as needed. This must be done after 1850 /* Adjust the overlay center as needed. This must be done after
1849 adjusting the markers that bound the overlays. */ 1851 adjusting the markers that bound the overlays. */
1850 adjust_overlays_for_delete (from, nchars_del); 1852 adjust_overlays_for_delete (from, nchars_del);
1851 adjust_overlays_for_insert (from, inschars); 1853 adjust_overlays_for_insert (from, inschars);
1852 if (nomarkers) 1854 if (markers)
1853 adjust_markers_for_insert (from, from_byte, 1855 adjust_markers_for_insert (from, from_byte,
1854 from + inschars, from_byte + outgoing_insbytes, 1856 from + inschars, from_byte + outgoing_insbytes,
1855 combined_before_bytes, combined_after_bytes, 0); 1857 combined_before_bytes, combined_after_bytes, 0);
1856 1858
1857 #ifdef USE_TEXT_PROPERTIES 1859 #ifdef USE_TEXT_PROPERTIES