aboutsummaryrefslogtreecommitdiffstats
path: root/src/insdel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/insdel.c')
-rw-r--r--src/insdel.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/insdel.c b/src/insdel.c
index 58c3e15c233..f746fd34330 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1756,27 +1756,22 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1756 return deletion; 1756 return deletion;
1757} 1757}
1758 1758
1759/* Call this if you're about to change the region of current buffer 1759/* Call this if you're about to change the text of current buffer
1760 from character positions START to END. This checks the read-only 1760 from character positions START to END. This checks the read-only
1761 properties of the region, calls the necessary modification hooks, 1761 properties of the region, calls the necessary modification hooks,
1762 and warns the next redisplay that it should pay attention to that 1762 and warns the next redisplay that it should pay attention to that
1763 area. 1763 area. */
1764
1765 If PRESERVE_CHARS_MODIFF, do not update CHARS_MODIFF.
1766 Otherwise set CHARS_MODIFF to the new value of MODIFF. */
1767 1764
1768void 1765void
1769modify_region_1 (ptrdiff_t start, ptrdiff_t end, bool preserve_chars_modiff) 1766modify_text (ptrdiff_t start, ptrdiff_t end)
1770{ 1767{
1771 prepare_to_modify_buffer (start, end, NULL); 1768 prepare_to_modify_buffer (start, end, NULL);
1772 1769
1773 BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end); 1770 BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end);
1774
1775 if (MODIFF <= SAVE_MODIFF) 1771 if (MODIFF <= SAVE_MODIFF)
1776 record_first_change (); 1772 record_first_change ();
1777 MODIFF++; 1773 MODIFF++;
1778 if (! preserve_chars_modiff) 1774 CHARS_MODIFF = MODIFF;
1779 CHARS_MODIFF = MODIFF;
1780 1775
1781 bset_point_before_scroll (current_buffer, Qnil); 1776 bset_point_before_scroll (current_buffer, Qnil);
1782} 1777}
@@ -1792,8 +1787,8 @@ modify_region_1 (ptrdiff_t start, ptrdiff_t end, bool preserve_chars_modiff)
1792 by holding its value temporarily in a marker. */ 1787 by holding its value temporarily in a marker. */
1793 1788
1794void 1789void
1795prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, 1790prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t end,
1796 ptrdiff_t *preserve_ptr) 1791 ptrdiff_t *preserve_ptr)
1797{ 1792{
1798 struct buffer *base_buffer; 1793 struct buffer *base_buffer;
1799 1794
@@ -1864,6 +1859,17 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1864 } 1859 }
1865 1860
1866 signal_before_change (start, end, preserve_ptr); 1861 signal_before_change (start, end, preserve_ptr);
1862 Vdeactivate_mark = Qt;
1863}
1864
1865/* Like above, but called when we know that the buffer text
1866 will be modified and region caches should be invalidated. */
1867
1868void
1869prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1870 ptrdiff_t *preserve_ptr)
1871{
1872 prepare_to_modify_buffer_1 (start, end, preserve_ptr);
1867 1873
1868 if (current_buffer->newline_cache) 1874 if (current_buffer->newline_cache)
1869 invalidate_region_cache (current_buffer, 1875 invalidate_region_cache (current_buffer,
@@ -1873,10 +1879,12 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1873 invalidate_region_cache (current_buffer, 1879 invalidate_region_cache (current_buffer,
1874 current_buffer->width_run_cache, 1880 current_buffer->width_run_cache,
1875 start - BEG, Z - end); 1881 start - BEG, Z - end);
1876 1882 if (current_buffer->bidi_paragraph_cache)
1877 Vdeactivate_mark = Qt; 1883 invalidate_region_cache (current_buffer,
1884 current_buffer->bidi_paragraph_cache,
1885 start - BEG, Z - end);
1878} 1886}
1879 1887
1880/* These macros work with an argument named `preserve_ptr' 1888/* These macros work with an argument named `preserve_ptr'
1881 and a local variable named `preserve_marker'. */ 1889 and a local variable named `preserve_marker'. */
1882 1890