mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-03 08:30:09 +00:00
Avoid assertions in find-composition
* src/font.c (font_range): If called with STRING non-nil and FACE a NULL pointer, compute face by calling face_at_string_position. (Bug#29506) * lisp/composite.el (find-composition): Doc fix.
This commit is contained in:
parent
408862f02a
commit
bdbcdbac43
@ -337,8 +337,9 @@ When Automatic Composition mode is on, this function also finds a
|
||||
chunk of text that is automatically composed. If such a chunk is
|
||||
found closer to POS than the position that has `composition'
|
||||
property, the value is a list of FROM, TO, and a glyph-string
|
||||
that specifies how the chunk is to be composed. See the function
|
||||
`composition-get-gstring' for the format of the glyph-string."
|
||||
that specifies how the chunk is to be composed; DETAIL-P is
|
||||
inored this case. See the function `composition-get-gstring'
|
||||
for the format of the glyph-string."
|
||||
(let ((result (find-composition-internal pos limit string detail-p)))
|
||||
(if (and detail-p (> (length result) 3) (nth 2 result) (not (nth 3 result)))
|
||||
;; This is a valid rule-base composition.
|
||||
|
25
src/font.c
25
src/font.c
@ -3794,19 +3794,26 @@ font_range (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t *limit,
|
||||
int c;
|
||||
Lisp_Object font_object = Qnil;
|
||||
|
||||
if (NILP (string))
|
||||
if (!face)
|
||||
{
|
||||
if (! face)
|
||||
{
|
||||
int face_id;
|
||||
struct frame *f = XFRAME (w->frame);
|
||||
int face_id;
|
||||
|
||||
face_id = face_at_buffer_position (w, pos, &ignore,
|
||||
*limit, false, -1);
|
||||
face = FACE_FROM_ID (XFRAME (w->frame), face_id);
|
||||
if (NILP (string))
|
||||
face_id = face_at_buffer_position (w, pos, &ignore, *limit,
|
||||
false, -1);
|
||||
else
|
||||
{
|
||||
face_id =
|
||||
NILP (Vface_remapping_alist)
|
||||
? DEFAULT_FACE_ID
|
||||
: lookup_basic_face (f, DEFAULT_FACE_ID);
|
||||
|
||||
face_id = face_at_string_position (w, string, pos, 0, &ignore,
|
||||
face_id, false);
|
||||
}
|
||||
face = FACE_FROM_ID (f, face_id);
|
||||
}
|
||||
else
|
||||
eassert (face);
|
||||
|
||||
while (pos < *limit)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user