diff src/xdisp.c @ 107590:ebdfe4d01cff

Retrospective commit from 2009-09-20. Handle positions at BEGV and ZV. Mor initialization cleanups. xdisp.c (reseat_1): Handle position < BEGV. bidi.c (bidi_paragraph_init): Set bidi_it->ch_len. Handle ZV. (bidi_init_it): Don't initialize bidi_it->ch_len. (bidi_resolve_explicit_1): Abort if bidi_it->ch_len was not initialized. (bidi_at_paragraph_end, bidi_resolve_explicit_1) (bidi_resolve_weak, bidi_level_of_next_char): Handle bytepos at ZV_BYTE. (bidi_resolve_explicit_1): Handle position < BEGV.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 31 Dec 2009 16:31:54 -0500
parents 84267baa779b
children 86eec24bee2c
line wrap: on
line diff
--- a/src/xdisp.c	Thu Dec 31 16:20:15 2009 -0500
+++ b/src/xdisp.c	Thu Dec 31 16:31:54 2009 -0500
@@ -5541,13 +5541,13 @@
 	 not be the character at POS.  We need to find the next
 	 character in visual order starting from the preceding
 	 character.  */
-      if ((it->bidi_it.charpos = CHARPOS (pos) - 1) > 1)
+      if ((it->bidi_it.charpos = CHARPOS (pos) - 1) >= BEGV)
 	{
 	  it->bidi_it.bytepos = CHAR_TO_BYTE (CHARPOS (pos) - 1);
-	  it->bidi_it.ch_len = CHAR_BYTES (CHARPOS (pos) - 1);
-	}
-      else
-	it->bidi_it.bytepos = 0;
+	  it->bidi_it.ch_len = CHAR_BYTES (FETCH_CHAR (it->bidi_it.bytepos));
+	}
+      else
+	it->bidi_it.bytepos = 0; /* signal bidi.c not to move */
       bidi_get_next_char_visually (&it->bidi_it);
       SET_TEXT_POS (pos, it->bidi_it.charpos, it->bidi_it.bytepos);
       it->current.pos = it->position = pos;