[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f273052: Improve the fix for bug#51864
From: |
Eli Zaretskii |
Subject: |
master f273052: Improve the fix for bug#51864 |
Date: |
Sun, 21 Nov 2021 02:53:29 -0500 (EST) |
branch: master
commit f2730520ce3159704801e7cd459e2971c191c5a3
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Improve the fix for bug#51864
* src/xfaces.c (face_at_buffer_position): Call
FACE_FROM_ID_OR_NULL just once.
(face_at_string_position): Make sure we have a usable base face.
---
src/xfaces.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/xfaces.c b/src/xfaces.c
index fec6b26..174a1ca 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4841,7 +4841,7 @@ lookup_named_face (struct window *w, struct frame *f,
/* Return the display face-id of the basic face whose canonical face-id
is FACE_ID. The return value will usually simply be FACE_ID, unless that
- basic face has bee remapped via Vface_remapping_alist. This function is
+ basic face has been remapped via Vface_remapping_alist. This function is
conservative: if something goes wrong, it will simply return FACE_ID
rather than signal an error. Window W, if non-NULL, is used to filter
face specifications for remapping. */
@@ -6372,20 +6372,16 @@ face_at_buffer_position (struct window *w, ptrdiff_t
pos,
int face_id;
if (base_face_id >= 0)
- {
- face_id = base_face_id;
- /* Make sure the base face ID is usable: if someone freed the
- cached faces since we've looked up the base face, we need
- to look it up again. */
- if (!FACE_FROM_ID_OR_NULL (f, face_id))
- face_id = lookup_basic_face (w, f, DEFAULT_FACE_ID);
- }
+ face_id = base_face_id;
else if (NILP (Vface_remapping_alist))
face_id = DEFAULT_FACE_ID;
else
face_id = lookup_basic_face (w, f, DEFAULT_FACE_ID);
default_face = FACE_FROM_ID_OR_NULL (f, face_id);
+ /* Make sure the default face ID is usable: if someone freed the
+ cached faces since we've looked up these faces, we need to look
+ them up again. */
if (!default_face)
default_face = FACE_FROM_ID (f,
lookup_basic_face (w, f, DEFAULT_FACE_ID));
@@ -6573,7 +6569,9 @@ face_at_string_position (struct window *w, Lisp_Object
string,
else
*endptr = -1;
- base_face = FACE_FROM_ID (f, base_face_id);
+ base_face = FACE_FROM_ID_OR_NULL (f, base_face_id);
+ if (!base_face)
+ base_face = FACE_FROM_ID (f, lookup_basic_face (w, f, DEFAULT_FACE_ID));
/* Optimize the default case that there is no face property. */
if (NILP (prop)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f273052: Improve the fix for bug#51864,
Eli Zaretskii <=