emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 529ec8d 3/6: Merge from emacs-26


From: Noam Postavsky
Subject: [Emacs-diffs] master 529ec8d 3/6: Merge from emacs-26
Date: Sat, 4 Aug 2018 11:56:23 -0400 (EDT)

branch: master
commit 529ec8df9355116b165b4ec588693934137c88ca
Merge: b6dd037 f0b8e64
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    Merge from emacs-26
    
    f0b8e64fb7 Avoid assertion violations in maybe_produce_line_number
    7669bf7880 Avoid assertion violations in set_text_properties_1
---
 src/textprop.c | 20 ++++++++++++++++++--
 src/xdisp.c    |  1 +
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/textprop.c b/src/textprop.c
index fe5b61e..ea1ae3b 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1350,6 +1350,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
 {
   register INTERVAL i;
   Lisp_Object ostart, oend;
+  bool first_time = true;
 
   ostart = start;
   oend = end;
@@ -1372,6 +1373,7 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
       return Qt;
     }
 
+ retry:
   i = validate_interval_range (object, &start, &end, soft);
 
   if (!i)
@@ -1391,8 +1393,22 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
        return Qnil;
     }
 
-  if (BUFFERP (object) && !NILP (coherent_change_p))
-    modify_text_properties (object, start, end);
+  if (BUFFERP (object) && !NILP (coherent_change_p) && first_time)
+    {
+      ptrdiff_t prev_length = LENGTH (i);
+      ptrdiff_t prev_pos = i->position;
+
+      modify_text_properties (object, start, end);
+      /* If someone called us recursively as a side effect of
+        modify_text_properties, and changed the intervals behind our
+        back, we cannot continue with I, because its data changed.
+        So we restart the interval analysis anew.  */
+      if (LENGTH (i) != prev_length || i->position != prev_pos)
+       {
+         first_time = false;
+         goto retry;
+       }
+    }
 
   set_text_properties_1 (start, end, properties, object, i);
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 316c12e..2719ade 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16916,6 +16916,7 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
       /* We used to issue a CHECK_MARGINS argument to try_window here,
         but this causes scrolling to fail when point begins inside
         the scroll margin (bug#148) -- cyd  */
+      clear_glyph_matrix (w->desired_matrix);
       if (!try_window (window, startp, 0))
        {
          w->force_start = true;



reply via email to

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