emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/extend_face_id 849baf6 10/12: Extend_face simplify


From: Jimmy Aguilar Mena
Subject: [Emacs-diffs] scratch/extend_face_id 849baf6 10/12: Extend_face simplify.
Date: Sat, 21 Sep 2019 14:54:28 -0400 (EDT)

branch: scratch/extend_face_id
commit 849baf6e5b7ae188f22cc5957623917b590329b0
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>

    Extend_face simplify.
    
    * src/dispextern.h (struct it) : Removed extend_face unneeded members.
    * src/xdisp.c (handle_face_prop_general) : renamed to face_at_pos and
    removed input parameter initial_face_id. Updated all occurrences.
---
 src/dispextern.h |  7 ++-----
 src/xdisp.c      | 23 +++++++++++------------
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/src/dispextern.h b/src/dispextern.h
index 7e0da64..727d550 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2326,7 +2326,7 @@ struct it
   /* Face id of the iterator saved in case a glyph from dpvec contains
      a face.  The face is restored when all glyphs from dpvec have
      been delivered.  */
-  int saved_face_id, saved_extend_face_id;
+  int saved_face_id;
 
   /* Vector of glyphs for control character translation.  The pointer
      dpvec is set to ctl_chars when a control character is translated.
@@ -2388,7 +2388,7 @@ struct it
     ptrdiff_t prev_stop;
     ptrdiff_t base_level_stop;
     struct composition_it cmp_it;
-    int face_id, extend_face_id;
+    int face_id;
 
     /* Save values specific to a given method.  */
     union {
@@ -2446,9 +2446,6 @@ struct it
   /* Face to use.  */
   int face_id;
 
-  /* Face to extend at EOL/  */
-  int extend_face_id;
-
   /* Setting of buffer-local variable selective-display-ellipses.  */
   bool_bf selective_display_ellipsis_p : 1;
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 23db697..4c62d54 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4115,8 +4115,7 @@ handle_fontified_prop (struct it *it)
  ***********************************************************************/
 
 static int
-handle_face_prop_general (struct it *it, int initial_face_id,
-                          enum lface_attribute_index attr_filter)
+face_at_pos (struct it *it, enum lface_attribute_index attr_filter)
 {
   int new_face_id;
   ptrdiff_t next_stop;
@@ -4220,13 +4219,13 @@ handle_face_prop_general (struct it *it, int 
initial_face_id,
      face will not change until limit, i.e. if the new face has a
      box, all characters up to limit will have one.  But, as
      usual, we don't know whether limit is really the end.  */
-  if (new_face_id != initial_face_id)
+  if (new_face_id != it->face_id)
     {
       struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
       /* If it->face_id is -1, old_face below will be NULL, see
         the definition of FACE_FROM_ID_OR_NULL.  This will happen
         if this is the initial call that gets the face.  */
-      struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, initial_face_id);
+      struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, it->face_id);
 
       /* If the value of face_id of the iterator is -1, we have to
         look in front of IT's position and see whether there is a
@@ -4257,7 +4256,7 @@ handle_face_prop_general (struct it *it, int 
initial_face_id,
 static enum prop_handled
 handle_face_prop (struct it *it)
 {
-  it->face_id = handle_face_prop_general (it, it->face_id, 0);
+  it->face_id = face_at_pos (it, 0);
   return HANDLED_NORMALLY;
 }
 
@@ -20482,15 +20481,15 @@ extend_face_to_end_of_line (struct it *it)
           || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0))
     return;
 
-  it->extend_face_id
-    = handle_face_prop_general (it, it->extend_face_id, LFACE_EXTEND_INDEX);
+  const int extend_face_id
+    = face_at_pos (it, LFACE_EXTEND_INDEX);
 
   /* Face extension extends the background and box of IT->extend_face_id
      to the end of the line.  If the background equals the background
      of the frame, we don't have to do anything.  */
   face = FACE_FROM_ID (f, (it->face_before_selective_p
-                          ? it->saved_face_id
-                          : it->extend_face_id));
+                           ? it->saved_face_id
+                           : extend_face_id));
 
   if (FRAME_WINDOW_P (f)
       && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row)
@@ -20581,7 +20580,7 @@ extend_face_to_end_of_line (struct it *it)
          Lisp_Object save_object = it->object;
          const int saved_face_id = it->face_id;
 
-         it->face_id = it->extend_face_id;
+         it->face_id = extend_face_id;
          it->avoid_cursor_p = true;
          it->object = Qnil;
 
@@ -20615,7 +20614,7 @@ extend_face_to_end_of_line (struct it *it)
                    = XFIXNAT (Vdisplay_fill_column_indicator_character);
                  it->face_id
                    = merge_faces (it->w, Qfill_column_indicator,
-                                  0, it->extend_face_id);
+                                  0, extend_face_id);
                  PRODUCE_GLYPHS (it);
                  it->face_id = save_face_id;
                }
@@ -20762,7 +20761,7 @@ extend_face_to_end_of_line (struct it *it)
            {
              int saved_face_id = it->face_id;
              it->face_id
-               = merge_faces (it->w, Qfill_column_indicator, 0, 
it->extend_face_id);
+               = merge_faces (it->w, Qfill_column_indicator, 0, 
extend_face_id);
              it->c = it->char_to_display
                = XFIXNAT (Vdisplay_fill_column_indicator_character);
 



reply via email to

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