From acc720988446dd047d9496f9fb958b703e29dc8d Mon Sep 17 00:00:00 2001 From: Jimmy Aguilar Mena Date: Sat, 21 Sep 2019 17:04:09 +0200 Subject: [PATCH] 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 8bbabbe30dc..0615b16d712 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2374,7 +2374,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. @@ -2436,7 +2436,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 { @@ -2494,9 +2494,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 5ed63234093..5f7799e5b63 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4158,8 +4158,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; @@ -4263,13 +4262,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 @@ -4300,7 +4299,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; } @@ -21582,15 +21581,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) @@ -21683,7 +21682,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; @@ -21717,7 +21716,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; } @@ -21864,7 +21863,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); -- 2.39.5