aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2008-09-09 11:07:49 +0000
committerKenichi Handa <[email protected]>2008-09-09 11:07:49 +0000
commit3ffdafce60e9aa286241c9a564ea6a8870714883 (patch)
tree4f17509b6008d60eaf0b26335861f12c627e7bd3 /src
parent6a57054b576a7b5710f4ee1a095eff1b0309dd0e (diff)
(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')
-rw-r--r--src/composite.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/composite.c b/src/composite.c
index 12120f05eb..eea2f9661b 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -994,7 +994,11 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
{
EMACS_INT start, end, c;
Lisp_Object prop, val;
+ /* This is from forward_to_next_line_start in xdisp.c. */
+ const int MAX_NEWLINE_DISTANCE = 500;
+ if (endpos > charpos + MAX_NEWLINE_DISTANCE)
+ endpos = charpos + MAX_NEWLINE_DISTANCE;
cmp_it->stop_pos = endpos;
if (find_composition (charpos, endpos, &start, &end, &prop, string)
&& COMPOSITION_VALID_P (start, end, prop))
@@ -1020,6 +1024,8 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
FETCH_STRING_CHAR_ADVANCE (c, string, charpos, bytepos);
else
FETCH_CHAR_ADVANCE (c, charpos, bytepos);
+ if (c == '\n')
+ break;
val = CHAR_TABLE_REF (Vcomposition_function_table, c);
if (! NILP (val))
{
@@ -1041,6 +1047,11 @@ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string)
}
}
}
+ if (charpos == endpos)
+ {
+ cmp_it->stop_pos = endpos;
+ cmp_it->ch = -2;
+ }
}
/* 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)
struct face *face;
Lisp_Object string;
{
+ if (cmp_it->ch == -2)
+ {
+ composition_compute_stop_pos (cmp_it, charpos, bytepos, endpos, string);
+ if (cmp_it->ch == -2)
+ return 0;
+ }
+
if (cmp_it->ch < 0)
{
/* We are looking at a static composition. */