emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110028: Avoid out-of-range marker po


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110028: Avoid out-of-range marker position (Bug#12426).
Date: Fri, 14 Sep 2012 18:23:50 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110028
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Fri 2012-09-14 18:23:50 +0400
message:
  Avoid out-of-range marker position (Bug#12426).
  * insdel.c (replace_range, replace_range_2): Adjust
  markers before overlays, as suggested by comments.
  (insert_1_both, insert_from_buffer_1, adjust_after_replace):
  Remove redundant check before calling offset_intervals.
modified:
  src/ChangeLog
  src/insdel.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-14 06:55:38 +0000
+++ b/src/ChangeLog     2012-09-14 14:23:50 +0000
@@ -1,3 +1,11 @@
+2012-09-14  Dmitry Antipov  <address@hidden>
+
+       Avoid out-of-range marker position (Bug#12426).
+       * insdel.c (replace_range, replace_range_2): Adjust
+       markers before overlays, as suggested by comments.
+       (insert_1_both, insert_from_buffer_1, adjust_after_replace):
+       Remove redundant check before calling offset_intervals.
+
 2012-09-14  Martin Rudalics  <address@hidden>
 
        * xdisp.c (Fformat_mode_line): Unconditionally save/restore

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2012-09-11 04:22:03 +0000
+++ b/src/insdel.c      2012-09-14 14:23:50 +0000
@@ -840,8 +840,7 @@
                             PT + nchars, PT_BYTE + nbytes,
                             before_markers);
 
-  if (buffer_intervals (current_buffer))
-    offset_intervals (current_buffer, PT, nchars);
+  offset_intervals (current_buffer, PT, nchars);
 
   if (!inherit && buffer_intervals (current_buffer))
     set_text_properties (make_number (PT), make_number (PT + nchars),
@@ -1153,8 +1152,7 @@
                             PT_BYTE + outgoing_nbytes,
                             0);
 
-  if (buffer_intervals (current_buffer))
-    offset_intervals (current_buffer, PT, nchars);
+  offset_intervals (current_buffer, PT, nchars);
 
   /* Get the intervals for the part of the string we are inserting.  */
   intervals = buffer_intervals (buf);
@@ -1222,8 +1220,7 @@
   else if (len < nchars_del)
     adjust_overlays_for_delete (from, nchars_del - len);
 
-  if (buffer_intervals (current_buffer))
-    offset_intervals (current_buffer, from, len - nchars_del);
+  offset_intervals (current_buffer, from, len - nchars_del);
 
   if (from < PT)
     adjust_point (len - nchars_del, len_byte - nbytes_del);
@@ -1394,16 +1391,16 @@
 
   eassert (GPT <= GPT_BYTE);
 
-  /* Adjust the overlay center as needed.  This must be done after
-     adjusting the markers that bound the overlays.  */
-  adjust_overlays_for_delete (from, nchars_del);
-  adjust_overlays_for_insert (from, inschars);
-
   /* Adjust markers for the deletion and the insertion.  */
   if (markers)
     adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
                                inschars, outgoing_insbytes);
 
+  /* Adjust the overlay center as needed.  This must be done after
+     adjusting the markers that bound the overlays.  */
+  adjust_overlays_for_delete (from, nchars_del);
+  adjust_overlays_for_insert (from, inschars);
+
   offset_intervals (current_buffer, from, inschars - nchars_del);
 
   /* Get the intervals for the part of the string we are inserting--
@@ -1510,6 +1507,12 @@
 
   eassert (GPT <= GPT_BYTE);
 
+  /* Adjust markers for the deletion and the insertion.  */
+  if (markers
+      && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
+    adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
+                               inschars, insbytes);
+
   /* Adjust the overlay center as needed.  This must be done after
      adjusting the markers that bound the overlays.  */
   if (nchars_del != inschars)
@@ -1518,12 +1521,6 @@
       adjust_overlays_for_delete (from + inschars, nchars_del);
     }
 
-  /* Adjust markers for the deletion and the insertion.  */
-  if (markers
-      && ! (nchars_del == 1 && inschars == 1 && nbytes_del == insbytes))
-    adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del,
-                               inschars, insbytes);
-
   offset_intervals (current_buffer, from, inschars - nchars_del);
 
   /* Relocate point as if it were a marker.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]