aboutsummaryrefslogtreecommitdiffstats
path: root/src/composite.c
diff options
context:
space:
mode:
authorKenichi Handa2010-08-25 13:39:30 +0900
committerKenichi Handa2010-08-25 13:39:30 +0900
commitf6aa6ec68ed936800ef2c3aefa42102e60b654cb (patch)
tree78fcb2a9695e6380d47e2942f1702c5f72288c92 /src/composite.c
parente87480069cbb711f5ebd2a9d2592dabd8147f57a (diff)
downloademacs-f6aa6ec68ed936800ef2c3aefa42102e60b654cb.tar.gz
emacs-f6aa6ec68ed936800ef2c3aefa42102e60b654cb.zip
Allow composition striding over PT.
Diffstat (limited to 'src/composite.c')
-rw-r--r--src/composite.c40
1 files changed, 6 insertions, 34 deletions
diff --git a/src/composite.c b/src/composite.c
index 3b128853c10..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;
@@ -1233,23 +1222,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1233int 1222int
1234composition_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)
1235{ 1224{
1236 if (endpos <= charpos) 1225 if (endpos < 0)
1237 { 1226 endpos = NILP (string) ? BEGV : 0;
1238 if (NILP (string))
1239 {
1240 if (endpos < 0)
1241 endpos = BEGV;
1242 if (endpos < PT && PT < charpos)
1243 endpos = PT;
1244 }
1245 else if (endpos < 0)
1246 endpos = 0;
1247 }
1248 else
1249 {
1250 if (NILP (string) && charpos < PT && PT < endpos)
1251 endpos = PT;
1252 }
1253 1227
1254 if (cmp_it->ch == -2) 1228 if (cmp_it->ch == -2)
1255 { 1229 {
@@ -1311,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
1311 elt = XCAR (val); 1285 elt = XCAR (val);
1312 if (cmp_it->lookback > 0) 1286 if (cmp_it->lookback > 0)
1313 { 1287 {
1314 cpos -= cmp_it->lookback; 1288 cpos = charpos - cmp_it->lookback;
1315 if (STRINGP (string)) 1289 if (STRINGP (string))
1316 bpos = string_char_to_byte (string, cpos); 1290 bpos = string_char_to_byte (string, cpos);
1317 else 1291 else
@@ -1773,8 +1747,6 @@ should be ignored. */)
1773 1747
1774 CHECK_NATNUM (from); 1748 CHECK_NATNUM (from);
1775 CHECK_NATNUM (to); 1749 CHECK_NATNUM (to);
1776 if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS)
1777 to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS);
1778 if (! FONT_OBJECT_P (font_object)) 1750 if (! FONT_OBJECT_P (font_object))
1779 { 1751 {
1780 struct coding_system *coding; 1752 struct coding_system *coding;