From: Kim F. Storm Date: Fri, 19 Mar 2004 20:32:39 +0000 (+0000) Subject: (move_it_in_display_line_to): Fix MOVE_TO_POS case when X-Git-Tag: ttn-vms-21-2-B4~7202 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4540d74ccddb176e48267e58c63eb7a3fff72f12;p=emacs.git (move_it_in_display_line_to): Fix MOVE_TO_POS case when to_charpos corresponds to newline in right fringe. Use local BUFFER_POS_REACHED_P macro. --- diff --git a/src/xdisp.c b/src/xdisp.c index cf8ca02bc10..d39c72f2588 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -5594,15 +5594,18 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) saved_glyph_row = it->glyph_row; it->glyph_row = NULL; +#define BUFFER_POS_REACHED_P() \ + ((op & MOVE_TO_POS) != 0 \ + && BUFFERP (it->object) \ + && IT_CHARPOS (*it) >= to_charpos) + while (1) { int x, i, ascent = 0, descent = 0; /* Stop when ZV or TO_CHARPOS reached. */ if (!get_next_display_element (it) - || ((op & MOVE_TO_POS) != 0 - && BUFFERP (it->object) - && IT_CHARPOS (*it) >= to_charpos)) + || BUFFER_POS_REACHED_P ()) { result = MOVE_POS_MATCH_OR_ZV; break; @@ -5689,7 +5692,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) #ifdef HAVE_WINDOW_SYSTEM if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) { - if (!get_next_display_element (it)) + if (!get_next_display_element (it) + || BUFFER_POS_REACHED_P ()) { result = MOVE_POS_MATCH_OR_ZV; break; @@ -5761,7 +5765,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) #ifdef HAVE_WINDOW_SYSTEM if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) { - if (!get_next_display_element (it)) + if (!get_next_display_element (it) + || BUFFER_POS_REACHED_P ()) { result = MOVE_POS_MATCH_OR_ZV; break; @@ -5778,6 +5783,8 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) } } +#undef BUFFER_POS_REACHED_P + /* Restore the iterator settings altered at the beginning of this function. */ it->glyph_row = saved_glyph_row;