diff options
| author | Kenichi Handa | 2008-09-18 06:20:42 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-09-18 06:20:42 +0000 |
| commit | ea8ba975fbb4da1be8fdee56b0bcc1a9adb78ad2 (patch) | |
| tree | 221019c941d3b94c02b27b523c01a9db80cadf29 /src/composite.c | |
| parent | 46f905e18a25390eda6db7705e2ddcf5e73305d2 (diff) | |
| download | emacs-ea8ba975fbb4da1be8fdee56b0bcc1a9adb78ad2.tar.gz emacs-ea8ba975fbb4da1be8fdee56b0bcc1a9adb78ad2.zip | |
(fill_gstring_header): Don't check FROM and TO here.
(composition_compute_stop_pos): Fix handling of static composition.
(Fcomposition_get_gstring): Check FROM and TO at first.
Diffstat (limited to 'src/composite.c')
| -rw-r--r-- | src/composite.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/composite.c b/src/composite.c index 5773744c083..1ec6f71855f 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -812,9 +812,8 @@ fill_gstring_header (header, start, end, font_object, string) | |||
| 812 | CHECK_STRING (string); | 812 | CHECK_STRING (string); |
| 813 | if (! STRING_MULTIBYTE (current_buffer->enable_multibyte_characters)) | 813 | if (! STRING_MULTIBYTE (current_buffer->enable_multibyte_characters)) |
| 814 | error ("Attempt to shape unibyte text"); | 814 | error ("Attempt to shape unibyte text"); |
| 815 | CHECK_NATNUM (start); | 815 | /* FROM and TO are checked by the caller. */ |
| 816 | from = XINT (start); | 816 | from = XINT (start); |
| 817 | CHECK_NATNUM (end); | ||
| 818 | to = XINT (end); | 817 | to = XINT (end); |
| 819 | if (from < 0 || from > to || to > SCHARS (string)) | 818 | if (from < 0 || from > to || to > SCHARS (string)) |
| 820 | args_out_of_range_3 (string, start, end); | 819 | args_out_of_range_3 (string, start, end); |
| @@ -1027,7 +1026,10 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1027 | else | 1026 | else |
| 1028 | FETCH_CHAR_ADVANCE (c, charpos, bytepos); | 1027 | FETCH_CHAR_ADVANCE (c, charpos, bytepos); |
| 1029 | if (c == '\n') | 1028 | if (c == '\n') |
| 1030 | break; | 1029 | { |
| 1030 | cmp_it->ch = -2; | ||
| 1031 | break; | ||
| 1032 | } | ||
| 1031 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); | 1033 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); |
| 1032 | if (! NILP (val)) | 1034 | if (! NILP (val)) |
| 1033 | { | 1035 | { |
| @@ -1050,7 +1052,6 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1050 | } | 1052 | } |
| 1051 | } | 1053 | } |
| 1052 | cmp_it->stop_pos = charpos; | 1054 | cmp_it->stop_pos = charpos; |
| 1053 | cmp_it->ch = -2; | ||
| 1054 | } | 1055 | } |
| 1055 | 1056 | ||
| 1056 | /* Check if the character at CHARPOS (and BYTEPOS) is composed | 1057 | /* Check if the character at CHARPOS (and BYTEPOS) is composed |
| @@ -1491,6 +1492,8 @@ must be ignore. */) | |||
| 1491 | Lisp_Object gstring, header; | 1492 | Lisp_Object gstring, header; |
| 1492 | EMACS_INT frompos, topos; | 1493 | EMACS_INT frompos, topos; |
| 1493 | 1494 | ||
| 1495 | CHECK_NATNUM (from); | ||
| 1496 | CHECK_NATNUM (to); | ||
| 1494 | if (! NILP (font_object)) | 1497 | if (! NILP (font_object)) |
| 1495 | CHECK_FONT_OBJECT (font_object); | 1498 | CHECK_FONT_OBJECT (font_object); |
| 1496 | header = fill_gstring_header (Qnil, from, to, font_object, string); | 1499 | header = fill_gstring_header (Qnil, from, to, font_object, string); |
| @@ -1498,10 +1501,8 @@ must be ignore. */) | |||
| 1498 | if (! NILP (gstring)) | 1501 | if (! NILP (gstring)) |
| 1499 | return gstring; | 1502 | return gstring; |
| 1500 | 1503 | ||
| 1501 | /* Maybe we should check this at the function's entry. --Stef */ | 1504 | frompos = XINT (from); |
| 1502 | CHECK_NATNUM (from); frompos = XINT (from); | 1505 | topos = XINT (to); |
| 1503 | CHECK_NATNUM (to); topos = XINT (to); | ||
| 1504 | |||
| 1505 | if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos) | 1506 | if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos) |
| 1506 | gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil); | 1507 | gstring_work = Fmake_vector (make_number (topos - frompos + 2), Qnil); |
| 1507 | LGSTRING_SET_HEADER (gstring_work, header); | 1508 | LGSTRING_SET_HEADER (gstring_work, header); |