summaryrefslogtreecommitdiff
path: root/src/composite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/composite.c b/src/composite.c
index a4db66b92d8..c2ade90d54a 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -575,7 +575,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
}
if (min_pos < max_pos)
{
- ptrdiff_t count = SPECPDL_INDEX ();
+ specpdl_ref count = SPECPDL_INDEX ();
specbind (Qinhibit_read_only, Qt);
specbind (Qinhibit_modification_hooks, Qt);
@@ -704,8 +704,8 @@ DEFUN ("clear-composition-cache", Fclear_composition_cache,
Clear composition cache. */)
(void)
{
- Lisp_Object args[] = {QCtest, Qequal, QCsize, make_fixnum (311)};
- gstring_hash_table = CALLMANY (Fmake_hash_table, args);
+ gstring_hash_table = CALLN (Fmake_hash_table, QCtest, Qequal,
+ QCsize, make_fixnum (311));
/* Fixme: We call Fclear_face_cache to force complete re-building of
display glyphs. But, it may be better to call this function from
Fclear_face_cache instead. */
@@ -892,7 +892,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
ptrdiff_t limit, struct window *win, struct face *face,
Lisp_Object string, Lisp_Object direction, int ch)
{
- ptrdiff_t count = SPECPDL_INDEX ();
+ specpdl_ref count = SPECPDL_INDEX ();
Lisp_Object pos = make_fixnum (charpos);
ptrdiff_t to;
ptrdiff_t pt = PT, pt_byte = PT_BYTE;
@@ -988,7 +988,9 @@ inhibit_auto_composition (void)
less than CHARPOS, search backward to ENDPOS+1 assuming that
set_iterator_to_next works in reverse order. In this case, if a
composition closest to CHARPOS is found, set cmp_it->stop_pos to
- the last character of the composition.
+ the last character of the composition. STRING, if non-nil, is
+ the string (as opposed to a buffer) whose characters should be
+ tested for being composable.
If no composition is found, set cmp_it->ch to -2. If a static
composition is found, set cmp_it->ch to -1. Otherwise, set
@@ -996,7 +998,9 @@ inhibit_auto_composition (void)
composition. */
void
-composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, Lisp_Object string)
+composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
+ ptrdiff_t bytepos, ptrdiff_t endpos,
+ Lisp_Object string)
{
ptrdiff_t start, end;
int c;
@@ -1035,7 +1039,9 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
cmp_it->stop_pos = endpos = start;
cmp_it->ch = -1;
}
- if (NILP (BVAR (current_buffer, enable_multibyte_characters))
+ if ((NILP (string)
+ && NILP (BVAR (current_buffer, enable_multibyte_characters)))
+ || (STRINGP (string) && !STRING_MULTIBYTE (string))
|| inhibit_auto_composition ())
return;
if (bytepos < 0)
@@ -1292,6 +1298,16 @@ composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
if (cmp_it->lookback > 0)
{
cpos = charpos - cmp_it->lookback;
+ /* Reject the composition if it starts before ENDPOS,
+ which here can only happen if
+ composition-break-at-point is non-nil and point is
+ inside the composition. */
+ if (cpos < endpos)
+ {
+ eassert (composition_break_at_point);
+ eassert (endpos == PT);
+ goto no_composition;
+ }
if (STRINGP (string))
bpos = string_char_to_byte (string, cpos);
else
@@ -1961,7 +1977,9 @@ See `find-composition' for more details. */)
if (!find_composition (from, to, &start, &end, &prop, string))
{
- if (!NILP (BVAR (current_buffer, enable_multibyte_characters))
+ if (((NILP (string)
+ && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
+ || (!NILP (string) && STRING_MULTIBYTE (string)))
&& ! inhibit_auto_composition ()
&& find_automatic_composition (from, to, (ptrdiff_t) -1,
&start, &end, &gstring, string))