Tested and fixed compute_display_string_pos for buffer iteration.
authorEli Zaretskii <eliz@gnu.org>
Fri, 10 Jun 2011 11:43:04 +0000 (14:43 +0300)
committerEli Zaretskii <eliz@gnu.org>
Fri, 10 Jun 2011 11:43:04 +0000 (14:43 +0300)
Also fixed an unrelated bug caused by vertical-motion.

 src/xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize
 itb.string.lstring.
 (compute_display_string_pos, compute_display_string_end):
 Fix calculation of the object to scan.  Fixes an error when using
 arrow keys.
 (next_element_from_buffer): Don't abort when IT_CHARPOS is before
 base_level_stop; instead, set base_level_stop to BEGV.  Fixes
 crashes in vertical-motion.

src/ChangeLog
src/xdisp.c

index 2f305d0..5aef6d2 100644 (file)
@@ -1,3 +1,14 @@
+2011-06-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize
+       itb.string.lstring.
+       (compute_display_string_pos, compute_display_string_end):
+       Fix calculation of the object to scan.  Fixes an error when using
+       arrow keys.
+       (next_element_from_buffer): Don't abort when IT_CHARPOS is before
+       base_level_stop; instead, set base_level_stop to BEGV.  Fixes
+       crashes in vertical-motion.
+
 2011-06-09  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (compute_display_string_pos): First arg is now struct
index 1194cce..8486808 100644 (file)
@@ -3111,7 +3111,7 @@ compute_display_string_pos (struct text_pos *position,
                            struct bidi_string_data *string, int frame_window_p)
 {
   /* OBJECT = nil means current buffer.  */
-  Lisp_Object object = string ? string->lstring : Qnil;
+  Lisp_Object object = (string && string->s) ? string->lstring : Qnil;
   Lisp_Object pos, spec;
   EMACS_INT eob = STRINGP (object) ? string->schars : ZV;
   EMACS_INT begb = STRINGP (object) ? 0 : BEGV;
@@ -3172,7 +3172,7 @@ EMACS_INT
 compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string)
 {
   /* OBJECT = nil means current buffer.  */
-  Lisp_Object object = string ? string->lstring : Qnil;
+  Lisp_Object object = (string && string->s) ? string->lstring : Qnil;
   Lisp_Object pos = make_number (charpos);
   EMACS_INT eob = STRINGP (object) ? string->schars : ZV;
 
@@ -6829,10 +6829,9 @@ next_element_from_buffer (struct it *it)
           && !BIDI_AT_BASE_LEVEL (it->bidi_it)
           && IT_CHARPOS (*it) < it->prev_stop)
     {
-      if (it->base_level_stop <= 0)
+      if (it->base_level_stop <= 0
+         || IT_CHARPOS (*it) < it->base_level_stop)
        it->base_level_stop = BEGV;
-      if (IT_CHARPOS (*it) < it->base_level_stop)
-       abort ();
       handle_stop_backwards (it, it->base_level_stop);
       return GET_NEXT_DISPLAY_ELEMENT (it);
     }
@@ -18228,6 +18227,7 @@ See also `bidi-paragraph-direction'.  */)
       itb.bytepos = bytepos;
       itb.nchars = -1;
       itb.string.s = NULL;
+      itb.string.lstring = Qnil;
       itb.frame_window_p = FRAME_WINDOW_P (SELECTED_FRAME ()); /* guesswork */
       itb.first_elt = 1;
       itb.separator_limit = -1;