changeset 107601:ee023eee6207

Retrospective commit from 2009-11-07. More fixes for iteration near ZV. bidi.c (bidi_paragraph_init): Don't overstep end of buffer. Treat end of buffer as a NEUTRAL_B character. (bidi_resolve_explicit): Don't special-case ZV when bidi_it->type is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the new_paragraph flag.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 01 Jan 2010 06:54:22 -0500
parents e47593843838
children d44bdcba4457
files src/ChangeLog.bidi src/bidi.c
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog.bidi	Fri Jan 01 06:49:38 2010 -0500
+++ b/src/ChangeLog.bidi	Fri Jan 01 06:54:22 2010 -0500
@@ -1,3 +1,11 @@
+2009-11-07  Eli Zaretskii  <eliz@gnu.org>
+
+	* bidi.c (bidi_paragraph_init): Don't overstep end of buffer.
+	Treat end of buffer as a NEUTRAL_B character.
+	(bidi_resolve_explicit): Don't special-case ZV when bidi_it->type
+	is NEUTRAL_B, since bidi_set_paragraph_end no longer sets the
+	new_paragraph flag.
+
 2009-10-31  Eli Zaretskii  <eliz@gnu.org>
 
 	* xdisp.c (display_line): Always extend reversed_p rows to the end
--- a/src/bidi.c	Fri Jan 01 06:49:38 2010 -0500
+++ b/src/bidi.c	Fri Jan 01 06:54:22 2010 -0500
@@ -927,6 +927,12 @@
 	{
 	  if (type == NEUTRAL_B && bidi_at_paragraph_end (pos, bytepos) >= -1)
 	    break;
+	  if (bytepos >= ZV_BYTE)
+	    {
+	      /* Pretend there's a paragraph separator at end of buffer.  */
+	      type = NEUTRAL_B;
+	      break;
+	    }
 	  FETCH_CHAR_ADVANCE (ch, pos, bytepos);
 	}
       if (type == STRONG_R || type == STRONG_AL) /* P3 */
@@ -1289,11 +1295,7 @@
 
   if (bidi_it->type == NEUTRAL_B)	/* X8 */
     {
-      /* End of buffer does _not_ indicate a new paragraph is coming.
-	 Otherwise, each character inserted at EOB will be processed
-	 as starting a new paragraph.  */
-      if (bidi_it->bytepos < ZV_BYTE)
-	bidi_set_paragraph_end (bidi_it);
+      bidi_set_paragraph_end (bidi_it);
       /* This is needed by bidi_resolve_weak below, and in L1.  */
       bidi_it->type_after_w1 = bidi_it->type;
       bidi_check_type (bidi_it->type_after_w1);