From 4c92356f0819ffe594cb16680a052a1a8a13f436 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 6 Dec 2007 07:24:26 +0000 Subject: [PATCH] (handle_auto_composed_prop): Fix previous change. --- src/xdisp.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index e120a8fa5a7..9c79684e438 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4553,7 +4553,7 @@ handle_auto_composed_prop (it) if (FUNCTIONP (Vauto_composition_function)) { - Lisp_Object val; + Lisp_Object val = Qnil; EMACS_INT pos, pos_byte, this_pos, start, end; int c; @@ -4596,7 +4596,8 @@ handle_auto_composed_prop (it) if (! EQ (font_object, font_at (c, pos, FACE_FROM_ID (it->f, it->face_id), it->w, it->string))) - /* We must re-compute the composition. */ + /* We must re-compute the composition for the + different font. */ val = Qnil; } #endif @@ -4618,22 +4619,16 @@ handle_auto_composed_prop (it) auto-composed region. There's a possiblity that the last characters in the region may be newly composed. */ - int charpos = end - 1, bytepos, c; - - if (STRINGP (it->string)) - { - bytepos = string_char_to_byte (it->string, charpos); - c = SDATA (it->string)[bytepos]; - } - else + if (pos < end - 1) { - bytepos = CHAR_TO_BYTE (charpos); - c = FETCH_BYTE (bytepos); + if (get_property_and_range (end - 1, Qcomposition, + &cmp_prop, &cmp_start, + &cmp_end, it->string)) + pos = cmp_start; + else + pos = end - 1; } - if (c != '\n') - /* If the last character is not newline, it may be - composed with the following characters. */ - val = Qnil, pos = charpos + 1; + val = Qnil; } } } -- 2.39.5