emacs-diffs
[Top][All Lists]
Advanced

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

master c80d2f3d67: Fix start-of-box-face display after display and overl


From: Eli Zaretskii
Subject: master c80d2f3d67: Fix start-of-box-face display after display and overlay strings
Date: Thu, 30 Dec 2021 06:24:36 -0500 (EST)

branch: master
commit c80d2f3d67d9802f39288945758f6bb7b88fd259
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix start-of-box-face display after display and overlay strings
    
    * src/xdisp.c (pop_it): Recompute the 'start_of_box_run_p' flag,
    like we do in 'handle_fontified_prop', when faces change while
    iterating over a buffer or string.  (Bug#51550)
---
 src/xdisp.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index a6c122aee8..6c63278f52 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6841,6 +6841,7 @@ pop_it (struct it *it)
   struct iterator_stack_entry *p;
   bool from_display_prop = it->from_disp_prop_p;
   ptrdiff_t prev_pos = IT_CHARPOS (*it);
+  int prev_face_id = it->face_id;
 
   eassert (it->sp > 0);
   --it->sp;
@@ -6876,9 +6877,18 @@ pop_it (struct it *it)
 
        /* Restore the face_box_p flag, since it could have been
           overwritten by the face of the object that we just finished
-          displaying.  */
+          displaying.  Also, set the start_of_box_run_p flag if the
+          change in faces requires that.  */
        if (face)
-         it->face_box_p = face->box != FACE_NO_BOX;
+         {
+           struct face *prev_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
+
+           if (!(it->start_of_box_run_p && prev_face && prev_face->box))
+             it->start_of_box_run_p = (face->box != FACE_NO_BOX
+                                       && (prev_face == NULL
+                                           || prev_face->box == FACE_NO_BOX));
+           it->face_box_p = face->box != FACE_NO_BOX;
+         }
        it->object = it->w->contents;
       }
       break;
@@ -6888,9 +6898,18 @@ pop_it (struct it *it)
 
        /* Restore the face_box_p flag, since it could have been
           overwritten by the face of the object that we just finished
-          displaying.  */
+          displaying.  Also, set the start_of_box_run_p flag if the
+          change in faces requires that.  */
        if (face)
-         it->face_box_p = face->box != FACE_NO_BOX;
+         {
+           struct face *prev_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
+
+           if (!(it->start_of_box_run_p && prev_face && prev_face->box))
+             it->start_of_box_run_p = (face->box != FACE_NO_BOX
+                                       && (prev_face == NULL
+                                           || prev_face->box == FACE_NO_BOX));
+           it->face_box_p = face->box != FACE_NO_BOX;
+         }
        it->object = it->string;
       }
       break;



reply via email to

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