From: Eli Zaretskii Date: Fri, 10 Jun 2011 11:43:04 +0000 (+0300) Subject: Tested and fixed compute_display_string_pos for buffer iteration. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~28 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9f4ef5002457676aefa18729cf6931e38e8e9f18;p=emacs.git Tested and fixed compute_display_string_pos for buffer iteration. 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index 2f305d0daf4..5aef6d2f112 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2011-06-10 Eli Zaretskii + + * 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 * xdisp.c (compute_display_string_pos): First arg is now struct diff --git a/src/xdisp.c b/src/xdisp.c index 1194cced38c..8486808bb40 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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;