aboutsummaryrefslogtreecommitdiffstats
path: root/src/composite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/src/composite.c b/src/composite.c
index 392da1ceba1..233f9ac8969 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -969,7 +969,9 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT
969static Lisp_Object _work_val; 969static Lisp_Object _work_val;
970static int _work_char; 970static int _work_char;
971 971
972/* 1 iff the character C is composable. */ 972/* 1 iff the character C is composable. Characters of general
973 category Z? or C? are not composable except for ZWNJ and ZWJ. */
974
973#define CHAR_COMPOSABLE_P(C) \ 975#define CHAR_COMPOSABLE_P(C) \
974 ((C) == 0x200C || (C) == 0x200D \ 976 ((C) == 0x200C || (C) == 0x200D \
975 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ 977 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \
@@ -1028,19 +1030,6 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1028 cmp_it->stop_pos = endpos = start; 1030 cmp_it->stop_pos = endpos = start;
1029 cmp_it->ch = -1; 1031 cmp_it->ch = -1;
1030 } 1032 }
1031 if (NILP (string))
1032 {
1033 /* A composition never strides over PT. */
1034 if (PT > charpos)
1035 {
1036 if (PT < endpos)
1037 cmp_it->stop_pos = endpos = PT;
1038 }
1039 else if (PT < charpos && PT > endpos)
1040 {
1041 cmp_it->stop_pos = endpos = PT - 1;
1042 }
1043 }
1044 if (NILP (current_buffer->enable_multibyte_characters) 1033 if (NILP (current_buffer->enable_multibyte_characters)
1045 || NILP (Vauto_composition_mode)) 1034 || NILP (Vauto_composition_mode))
1046 return; 1035 return;
@@ -1091,6 +1080,16 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1091 } 1080 }
1092 } 1081 }
1093 } 1082 }
1083 if (charpos == endpos)
1084 {
1085 /* We couldn't find a composition point before ENDPOS. But,
1086 some character after ENDPOS may be composed with
1087 characters before ENDPOS. So, we should stop at the safe
1088 point. */
1089 charpos = endpos - MAX_AUTO_COMPOSITION_LOOKBACK;
1090 if (charpos < start)
1091 charpos = start;
1092 }
1094 } 1093 }
1095 else if (charpos > endpos) 1094 else if (charpos > endpos)
1096 { 1095 {
@@ -1223,23 +1222,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1223int 1222int
1224composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) 1223composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string)
1225{ 1224{
1226 if (endpos <= charpos) 1225 if (endpos < 0)
1227 { 1226 endpos = NILP (string) ? BEGV : 0;
1228 if (NILP (string))
1229 {
1230 if (endpos < 0)
1231 endpos = BEGV;
1232 if (endpos < PT && PT < charpos)
1233 endpos = PT;
1234 }
1235 else if (endpos < 0)
1236 endpos = 0;
1237 }
1238 else
1239 {
1240 if (NILP (string) && charpos < PT && PT < endpos)
1241 endpos = PT;
1242 }
1243 1227
1244 if (cmp_it->ch == -2) 1228 if (cmp_it->ch == -2)
1245 { 1229 {
@@ -1301,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
1301 elt = XCAR (val); 1285 elt = XCAR (val);
1302 if (cmp_it->lookback > 0) 1286 if (cmp_it->lookback > 0)
1303 { 1287 {
1304 cpos -= cmp_it->lookback; 1288 cpos = charpos - cmp_it->lookback;
1305 if (STRINGP (string)) 1289 if (STRINGP (string))
1306 bpos = string_char_to_byte (string, cpos); 1290 bpos = string_char_to_byte (string, cpos);
1307 else 1291 else
@@ -1763,8 +1747,6 @@ should be ignored. */)
1763 1747
1764 CHECK_NATNUM (from); 1748 CHECK_NATNUM (from);
1765 CHECK_NATNUM (to); 1749 CHECK_NATNUM (to);
1766 if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS)
1767 to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS);
1768 if (! FONT_OBJECT_P (font_object)) 1750 if (! FONT_OBJECT_P (font_object))
1769 { 1751 {
1770 struct coding_system *coding; 1752 struct coding_system *coding;