changeset 89673:d563d35e3d58

(handle_auto_composed_prop): Give limit to Fnext_single_char_property_change.
author Kenichi Handa <handa@m17n.org>
date Tue, 02 Dec 2003 04:40:49 +0000
parents 3b65414d605d
children 481e76f32323
files src/xdisp.c
diffstat 1 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Tue Dec 02 01:55:21 2003 +0000
+++ b/src/xdisp.c	Tue Dec 02 04:40:49 2003 +0000
@@ -3788,14 +3788,18 @@
       val =Fget_char_property (make_number (pos), Qauto_composed, it->string);
       if (! NILP (val))
 	{
-	  Lisp_Object next;
-
+	  Lisp_Object limit = Qnil, next;
+	  
+	  /* As Fnext_single_char_property_change is very slow, we
+	     limit the search to the current line.  */
+	  if (! STRINGP (it->string))
+	    limit = make_number (find_next_newline_no_quit (pos, 1));
 	  next = (Fnext_single_property_change
-		     (make_number (pos), Qauto_composed, it->string, Qnil));
-	  if (INTEGERP (next))
+		     (make_number (pos), Qauto_composed, it->string, limit));
+	  if (XINT (next) < XINT (limit))
 	    {
 	      /* The current point is auto-composed, but there exist
-		 characers not yet composed beyond the auto-compused
+		 characters not yet composed beyond the auto-composed
 		 region.  There's a possiblity that the last
 		 characters in the region may be newly composed.  */
 	      int charpos = XINT (next) - 1, bytepos, c;
@@ -3828,11 +3832,16 @@
 	  safe_call (3, args);
 	  unbind_to (count, Qnil);
 
-	  val = Fget_char_property (args[1], Qauto_composed, it->string);
-	  /* Return HANDLED_RECOMPUTE_PROPS only if function fontified
-	     something.  This avoids an endless loop if they failed to
-	     fontify the text for which reason ever.  */
-	  if (! NILP (val))
+	  if (this_pos == pos)
+	    {
+	      val = Fget_char_property (args[1], Qauto_composed, it->string);
+	      /* Return HANDLED_RECOMPUTE_PROPS only if function composed
+		 something.  This avoids an endless loop if they failed to
+		 fontify the text for which reason ever.  */
+	      if (! NILP (val))
+		handled = HANDLED_RECOMPUTE_PROPS;
+	    }
+	  else
 	    handled = HANDLED_RECOMPUTE_PROPS;
 	}
     }