diff options
| author | Richard M. Stallman | 1998-08-03 22:25:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-08-03 22:25:54 +0000 |
| commit | 255c7daeba7911fc1cd4790567b48759bd62af20 (patch) | |
| tree | 85be7d1b508702be26fcdd8a994576e80bedd9f1 /src | |
| parent | 0c1e3b856ccc921729fc5498e414f33359b25b3f (diff) | |
| download | emacs-255c7daeba7911fc1cd4790567b48759bd62af20.tar.gz emacs-255c7daeba7911fc1cd4790567b48759bd62af20.zip | |
(replace_range): Don't assume PT is at the place
where the change is being done.
Diffstat (limited to 'src')
| -rw-r--r-- | src/insdel.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/insdel.c b/src/insdel.c index 80e9d7862f8..4b906dc3f32 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1788,16 +1788,16 @@ replace_range (from, to, new, prepare, inherit, nomarkers) | |||
| 1788 | STRING_MULTIBYTE (new), | 1788 | STRING_MULTIBYTE (new), |
| 1789 | ! NILP (current_buffer->enable_multibyte_characters)); | 1789 | ! NILP (current_buffer->enable_multibyte_characters)); |
| 1790 | 1790 | ||
| 1791 | /* We have copied text into the gap, but we have not altered | 1791 | /* We have copied text into the gap, but we have not marked |
| 1792 | PT or PT_BYTE yet. So we can pass PT and PT_BYTE | 1792 | it as part of the buffer. So we can use the old FROM and FROM_BYTE |
| 1793 | to these functions and get the same results as we would | 1793 | here, for both the previous text and the following text. |
| 1794 | have got earlier on. Meanwhile, GPT_ADDR does point to | 1794 | Meanwhile, GPT_ADDR does point to |
| 1795 | the text that has been stored by copy_text. */ | 1795 | the text that has been stored by copy_text. */ |
| 1796 | 1796 | ||
| 1797 | combined_before_bytes | 1797 | combined_before_bytes |
| 1798 | = count_combining_before (GPT_ADDR, outgoing_insbytes, PT, PT_BYTE); | 1798 | = count_combining_before (GPT_ADDR, outgoing_insbytes, from, from_byte); |
| 1799 | combined_after_bytes | 1799 | combined_after_bytes |
| 1800 | = count_combining_after (GPT_ADDR, outgoing_insbytes, PT, PT_BYTE); | 1800 | = count_combining_after (GPT_ADDR, outgoing_insbytes, from, from_byte); |
| 1801 | 1801 | ||
| 1802 | /* Record deletion of the surrounding text that combines with | 1802 | /* Record deletion of the surrounding text that combines with |
| 1803 | the insertion. This, together with recording the insertion, | 1803 | the insertion. This, together with recording the insertion, |
| @@ -1812,15 +1812,15 @@ replace_range (from, to, new, prepare, inherit, nomarkers) | |||
| 1812 | deletion = Qnil; | 1812 | deletion = Qnil; |
| 1813 | 1813 | ||
| 1814 | if (! EQ (current_buffer->undo_list, Qt)) | 1814 | if (! EQ (current_buffer->undo_list, Qt)) |
| 1815 | deletion = make_buffer_string_both (PT, PT_BYTE, | 1815 | deletion = make_buffer_string_both (from, from_byte, |
| 1816 | PT + combined_after_bytes, | 1816 | from + combined_after_bytes, |
| 1817 | PT_BYTE + combined_after_bytes, 1); | 1817 | from_byte + combined_after_bytes, 1); |
| 1818 | 1818 | ||
| 1819 | adjust_markers_for_record_delete (PT, PT_BYTE, | 1819 | adjust_markers_for_record_delete (from, from_byte, |
| 1820 | PT + combined_after_bytes, | 1820 | from + combined_after_bytes, |
| 1821 | PT_BYTE + combined_after_bytes); | 1821 | from_byte + combined_after_bytes); |
| 1822 | if (! EQ (current_buffer->undo_list, Qt)) | 1822 | if (! EQ (current_buffer->undo_list, Qt)) |
| 1823 | record_delete (PT, deletion); | 1823 | record_delete (from, deletion); |
| 1824 | } | 1824 | } |
| 1825 | 1825 | ||
| 1826 | if (combined_before_bytes) | 1826 | if (combined_before_bytes) |
| @@ -1829,15 +1829,15 @@ replace_range (from, to, new, prepare, inherit, nomarkers) | |||
| 1829 | deletion = Qnil; | 1829 | deletion = Qnil; |
| 1830 | 1830 | ||
| 1831 | if (! EQ (current_buffer->undo_list, Qt)) | 1831 | if (! EQ (current_buffer->undo_list, Qt)) |
| 1832 | deletion = make_buffer_string_both (PT - 1, CHAR_TO_BYTE (PT - 1), | 1832 | deletion = make_buffer_string_both (from - 1, CHAR_TO_BYTE (from - 1), |
| 1833 | PT, PT_BYTE, 1); | 1833 | from, from_byte, 1); |
| 1834 | adjust_markers_for_record_delete (PT - 1, CHAR_TO_BYTE (PT - 1), | 1834 | adjust_markers_for_record_delete (from - 1, CHAR_TO_BYTE (from - 1), |
| 1835 | PT, PT_BYTE); | 1835 | from, from_byte); |
| 1836 | if (! EQ (current_buffer->undo_list, Qt)) | 1836 | if (! EQ (current_buffer->undo_list, Qt)) |
| 1837 | record_delete (PT - 1, deletion); | 1837 | record_delete (from - 1, deletion); |
| 1838 | } | 1838 | } |
| 1839 | 1839 | ||
| 1840 | record_insert (PT - !!combined_before_bytes, | 1840 | record_insert (from - !!combined_before_bytes, |
| 1841 | inschars - combined_before_bytes + !!combined_before_bytes); | 1841 | inschars - combined_before_bytes + !!combined_before_bytes); |
| 1842 | 1842 | ||
| 1843 | GAP_SIZE -= outgoing_insbytes; | 1843 | GAP_SIZE -= outgoing_insbytes; |
| @@ -1866,7 +1866,7 @@ replace_range (from, to, new, prepare, inherit, nomarkers) | |||
| 1866 | combined_before_bytes, combined_after_bytes, 0); | 1866 | combined_before_bytes, combined_after_bytes, 0); |
| 1867 | 1867 | ||
| 1868 | #ifdef USE_TEXT_PROPERTIES | 1868 | #ifdef USE_TEXT_PROPERTIES |
| 1869 | offset_intervals (current_buffer, PT, inschars - nchars_del); | 1869 | offset_intervals (current_buffer, from, inschars - nchars_del); |
| 1870 | 1870 | ||
| 1871 | /* Get the intervals for the part of the string we are inserting-- | 1871 | /* Get the intervals for the part of the string we are inserting-- |
| 1872 | not including the combined-before bytes. */ | 1872 | not including the combined-before bytes. */ |
| @@ -1899,7 +1899,7 @@ replace_range (from, to, new, prepare, inherit, nomarkers) | |||
| 1899 | MODIFF++; | 1899 | MODIFF++; |
| 1900 | UNGCPRO; | 1900 | UNGCPRO; |
| 1901 | 1901 | ||
| 1902 | signal_after_change (from, nchars_del, PT - from); | 1902 | signal_after_change (from, nchars_del, GPT - from); |
| 1903 | } | 1903 | } |
| 1904 | 1904 | ||
| 1905 | /* Delete characters in current buffer | 1905 | /* Delete characters in current buffer |