diff options
| author | Kenichi Handa | 2008-09-09 11:07:49 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2008-09-09 11:07:49 +0000 |
| commit | 3ffdafce60e9aa286241c9a564ea6a8870714883 (patch) | |
| tree | 4f17509b6008d60eaf0b26335861f12c627e7bd3 /src/composite.c | |
| parent | 6a57054b576a7b5710f4ee1a095eff1b0309dd0e (diff) | |
| download | emacs-3ffdafce60e9aa286241c9a564ea6a8870714883.tar.gz emacs-3ffdafce60e9aa286241c9a564ea6a8870714883.zip | |
(composition_compute_stop_pos): Limit the search of composition to
at most 500 characters ahead. If we reach the limit or find a
newline, set cmp_it->ch to -2 and return 0.
(composition_reseat_it): Handle the case that cmp_it->ch is -2.
Diffstat (limited to 'src/composite.c')
| -rw-r--r-- | src/composite.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/composite.c b/src/composite.c index 12120f05ebb..eea2f9661b4 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -994,7 +994,11 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 994 | { | 994 | { |
| 995 | EMACS_INT start, end, c; | 995 | EMACS_INT start, end, c; |
| 996 | Lisp_Object prop, val; | 996 | Lisp_Object prop, val; |
| 997 | /* This is from forward_to_next_line_start in xdisp.c. */ | ||
| 998 | const int MAX_NEWLINE_DISTANCE = 500; | ||
| 997 | 999 | ||
| 1000 | if (endpos > charpos + MAX_NEWLINE_DISTANCE) | ||
| 1001 | endpos = charpos + MAX_NEWLINE_DISTANCE; | ||
| 998 | cmp_it->stop_pos = endpos; | 1002 | cmp_it->stop_pos = endpos; |
| 999 | if (find_composition (charpos, endpos, &start, &end, &prop, string) | 1003 | if (find_composition (charpos, endpos, &start, &end, &prop, string) |
| 1000 | && COMPOSITION_VALID_P (start, end, prop)) | 1004 | && COMPOSITION_VALID_P (start, end, prop)) |
| @@ -1020,6 +1024,8 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1020 | FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos); | 1024 | FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos); |
| 1021 | else | 1025 | else |
| 1022 | FETCH_CHAR_ADVANCE (c, charpos, bytepos); | 1026 | FETCH_CHAR_ADVANCE (c, charpos, bytepos); |
| 1027 | if (c == '\n') | ||
| 1028 | break; | ||
| 1023 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); | 1029 | val = CHAR_TABLE_REF (Vcomposition_function_table, c); |
| 1024 | if (! NILP (val)) | 1030 | if (! NILP (val)) |
| 1025 | { | 1031 | { |
| @@ -1041,6 +1047,11 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string) | |||
| 1041 | } | 1047 | } |
| 1042 | } | 1048 | } |
| 1043 | } | 1049 | } |
| 1050 | if (charpos == endpos) | ||
| 1051 | { | ||
| 1052 | cmp_it->stop_pos = endpos; | ||
| 1053 | cmp_it->ch = -2; | ||
| 1054 | } | ||
| 1044 | } | 1055 | } |
| 1045 | 1056 | ||
| 1046 | /* Check if the character at CHARPOS (and BYTEPOS) is composed | 1057 | /* Check if the character at CHARPOS (and BYTEPOS) is composed |
| @@ -1062,6 +1073,13 @@ composition_reseat_it (cmp_it, charpos, bytepos, endpos, w, face, string) | |||
| 1062 | struct face *face; | 1073 | struct face *face; |
| 1063 | Lisp_Object string; | 1074 | Lisp_Object string; |
| 1064 | { | 1075 | { |
| 1076 | if (cmp_it->ch == -2) | ||
| 1077 | { | ||
| 1078 | composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string); | ||
| 1079 | if (cmp_it->ch == -2) | ||
| 1080 | return 0; | ||
| 1081 | } | ||
| 1082 | |||
| 1065 | if (cmp_it->ch < 0) | 1083 | if (cmp_it->ch < 0) |
| 1066 | { | 1084 | { |
| 1067 | /* We are looking at a static composition. */ | 1085 | /* We are looking at a static composition. */ |