[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/extend_face_id 9fa74c4 05/15: Changed handle_face_
From: |
Jimmy Aguilar Mena |
Subject: |
[Emacs-diffs] feature/extend_face_id 9fa74c4 05/15: Changed handle_face_prop_general prototype. |
Date: |
Wed, 9 Oct 2019 10:53:11 -0400 (EDT) |
branch: feature/extend_face_id
commit 9fa74c4b5a64248bb22f197905ef4fd497396b5c
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>
Changed handle_face_prop_general prototype.
* src/xdisp.h (handle_face_prop_general): Changed function prototype
to receive different arguments.
---
src/xdisp.c | 97 +++++++++++++++++++++++++------------------------------------
1 file changed, 40 insertions(+), 57 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 844cda9..796c199 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4148,14 +4148,15 @@ handle_fontified_prop (struct it *it)
Faces
***********************************************************************/
-static enum prop_handled
-handle_face_prop_general (struct it *it, int *face_id_ptr,
+static int
+handle_face_prop_general (struct it *it, int initial_face_id,
enum lface_attribute_index attr_filter)
{
int new_face_id;
ptrdiff_t next_stop;
+ const bool is_string = STRINGP (it->string);
- if (!STRINGP (it->string))
+ if (!is_string)
{
new_face_id
= face_at_buffer_position (it->w,
@@ -4164,39 +4165,7 @@ handle_face_prop_general (struct it *it, int
*face_id_ptr,
(IT_CHARPOS (*it)
+ TEXT_PROP_DISTANCE_LIMIT),
false, it->base_face_id, attr_filter);
-
- /* Is this a start of a run of characters with box face?
- Caveat: this can be called for a freshly initialized
- iterator; face_id is -1 in this case. We know that the new
- 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 != *face_id_ptr)
- {
- 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, *face_id_ptr);
-
- /* 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
- face there that's different from new_face_id. */
- if (!old_face && IT_CHARPOS (*it) > BEG)
- {
- int prev_face_id = face_before_it_pos (it);
-
- old_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
- }
-
- /* If the new face has a box, but the old face does not,
- this is the start of a run of characters with box face,
- i.e. this character has a shadow on the left side. */
- it->start_of_box_run_p = (new_face->box != FACE_NO_BOX
- && (old_face == NULL || !old_face->box));
- it->face_box_p = new_face->box != FACE_NO_BOX;
- }
- }
+ }
else
{
int base_face_id;
@@ -4275,40 +4244,53 @@ handle_face_prop_general (struct it *it, int
*face_id_ptr,
bufpos,
&next_stop,
base_face_id, false);
+ }
+
+ /* Is this a start of a run of characters with box face?
+ Caveat: this can be called for a freshly initialized
+ iterator; face_id is -1 in this case. We know that the new
+ 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)
+ {
+ 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);
- /* Is this a start of a run of characters with box? Caveat:
- this can be called for a freshly allocated iterator; face_id
- is -1 is this case. We know that the new face will not
- change until the next check pos, i.e. if the new face has a
- box, all characters up to that position will have a
- box. But, as usual, we don't know whether that position
- is really the end. */
- if (new_face_id != *face_id_ptr)
+ /* 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
+ face there that's different from new_face_id. */
+ if (!is_string
+ && !old_face
+ && IT_CHARPOS (*it) > BEG)
{
- struct face *new_face = FACE_FROM_ID (it->f, new_face_id);
- struct face *old_face = FACE_FROM_ID_OR_NULL (it->f, *face_id_ptr);
+ int prev_face_id = face_before_it_pos (it);
- /* If new face has a box but old face hasn't, this is the
- start of a run of characters with box, i.e. it has a
- shadow on the left side. */
- it->start_of_box_run_p
- = new_face->box && (old_face == NULL || !old_face->box);
- it->face_box_p = new_face->box != FACE_NO_BOX;
+ old_face = FACE_FROM_ID_OR_NULL (it->f, prev_face_id);
}
+
+ /* If the new face has a box, but the old face does not,
+ this is the start of a run of characters with box face,
+ i.e. this character has a shadow on the left side. */
+ it->start_of_box_run_p = (new_face->box != FACE_NO_BOX
+ && (old_face == NULL || !old_face->box));
+ it->face_box_p = new_face->box != FACE_NO_BOX;
}
- *face_id_ptr = new_face_id;
- return HANDLED_NORMALLY;
+ return new_face_id;
}
/* Set up iterator IT from face properties at its current position.
Called from handle_stop. */
-
static enum prop_handled
handle_face_prop (struct it *it)
{
- return handle_face_prop_general (it, &(it->face_id), 0);
+ it->face_id = handle_face_prop_general (it, it->face_id, 0);
+ return HANDLED_NORMALLY;
}
@@ -21596,7 +21578,8 @@ extend_face_to_end_of_line (struct it *it)
|| WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0))
return;
- handle_face_prop_general (it, &(it->extend_face_id), LFACE_EXTEND_INDEX);
+ it->extend_face_id
+ = handle_face_prop_general (it, it->extend_face_id, 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
- [Emacs-diffs] branch feature/extend_face_id created (now 0a7b2b0), Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 92e9f9d 02/15: Added face parameter :extend., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id e4761a2 07/15: Fix last change in append_space_for_newline., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id bc9905a 11/15: Optimization in extend_face, Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 9750a03 12/15: Fixed merge_face_ref recursive calls., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 111dcf8 01/15: Simplify struct face to use only underline., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id d8cb394 08/15: Make hl-line face to extend all the line.., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 41d6d91 04/15: Fixed extend face filtered for prop., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id d5ded9d 03/15: Conditional merged face to extend after eol., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 567644e 06/15: Add space for cursor to work also in terminal., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 9fa74c4 05/15: Changed handle_face_prop_general prototype.,
Jimmy Aguilar Mena <=
- [Emacs-diffs] feature/extend_face_id 834e23f 09/15: Added parameter attr_filter to face_at_string_position., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id ae9787b 10/15: Extend_face simplify., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 19801c2 14/15: * etc/NEWS : Added comment about :extend face attribute in NEWS., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 6b50c01 13/15: Document new :extend face attribute in manuals., Jimmy Aguilar Mena, 2019/10/09
- [Emacs-diffs] feature/extend_face_id 0a7b2b0 15/15: ; extend_face_id and fill_column_indicator corrections, Jimmy Aguilar Mena, 2019/10/09