emacs-diffs
[Top][All Lists]
Advanced

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

master 8b90d91f21: Fix previous change in 'pop_it'


From: Eli Zaretskii
Subject: master 8b90d91f21: Fix previous change in 'pop_it'
Date: Thu, 30 Dec 2021 06:33:27 -0500 (EST)

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

    Fix previous change in 'pop_it'
    
    * src/xdisp.c (restore_face_box_flags): New function.
    (pop_it): Use 'restore_face_box_flags'.  (Bug#51550)
---
 src/xdisp.c | 55 +++++++++++++++++++++++--------------------------------
 1 file changed, 23 insertions(+), 32 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 6c63278f52..4136079f49 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6829,6 +6829,27 @@ iterate_out_of_display_property (struct it *it)
     it->current.string_pos = it->position;
 }
 
+/* Restore the IT->face_box_p flag, since it could have been
+   overwritten by the face of the object that we just finished
+   displaying.  Also, set the IT->start_of_box_run_p flag if the
+   change in faces requires that.  */
+static void
+restore_face_box_flags (struct it *it, int prev_face_id)
+{
+  struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
+
+  if (face)
+    {
+      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;
+    }
+}
+
 /* Restore IT's settings from IT->stack.  Called, for example, when no
    more overlay strings must be processed, and we return to delivering
    display elements from a buffer, or when the end of a string from a
@@ -6873,43 +6894,13 @@ pop_it (struct it *it)
       break;
     case GET_FROM_BUFFER:
       {
-       struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
-
-       /* Restore the face_box_p flag, since it could have been
-          overwritten by the face of the object that we just finished
-          displaying.  Also, set the start_of_box_run_p flag if the
-          change in faces requires that.  */
-       if (face)
-         {
-           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;
-         }
+       restore_face_box_flags (it, prev_face_id);
        it->object = it->w->contents;
       }
       break;
     case GET_FROM_STRING:
       {
-       struct face *face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
-
-       /* Restore the face_box_p flag, since it could have been
-          overwritten by the face of the object that we just finished
-          displaying.  Also, set the start_of_box_run_p flag if the
-          change in faces requires that.  */
-       if (face)
-         {
-           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;
-         }
+       restore_face_box_flags (it, prev_face_id);
        it->object = it->string;
       }
       break;



reply via email to

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