From: Eli Zaretskii Date: Sat, 6 Aug 2011 11:49:35 +0000 (+0300) Subject: Really fix bug #9224 with vertical-motion under word-wrap. X-Git-Tag: emacs-pretest-24.0.90~104^2~124^2~63^2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75b771e489a32ab716b031664baee313a78caf6b;p=emacs.git Really fix bug #9224 with vertical-motion under word-wrap. src/xdisp.c (move_it_in_display_line_to): Fix vertical-motion in a buffer with word-wrap under bidirectional display. --- diff --git a/src/ChangeLog b/src/ChangeLog index efe542e37d0..039c225c1f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,8 @@ * xdisp.c (set_cursor_from_row): Fix cursor positioning when a display property strides EOL and includes a newline, as in longlines-mode. (Bug#9254) + (move_it_in_display_line_to): Fix vertical-motion in a buffer with + word-wrap under bidirectional display. (Bug#9224) * bidi.c (bidi_unshelve_cache): Don't reset the cache if JUST_FREE is non-zero, even if the data buffer is NULL. Fixes a crash in diff --git a/src/xdisp.c b/src/xdisp.c index 9c281c6736b..6e9474e3c10 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -8009,13 +8009,19 @@ move_it_in_display_line_to (struct it *it, positions smaller than TO_CHARPOS, return MOVE_POS_MATCH_OR_ZV, like the unidirectional display did. */ - if (it->bidi_p && (op & MOVE_TO_POS) != 0 - && !saw_smaller_pos - && IT_CHARPOS (*it) > to_charpos) + if (it->bidi_p && (op & MOVE_TO_POS) != 0) { - if (IT_CHARPOS (ppos_it) < ZV) - RESTORE_IT (it, &ppos_it, ppos_data); - goto buffer_pos_reached; + if (!saw_smaller_pos && IT_CHARPOS (*it) > to_charpos) + { + if (IT_CHARPOS (ppos_it) < ZV) + RESTORE_IT (it, &ppos_it, ppos_data); + goto buffer_pos_reached; + } + else if (it->line_wrap == WORD_WRAP && atpos_it.sp >= 0 + && IT_CHARPOS (*it) > to_charpos) + goto buffer_pos_reached; + else + result = MOVE_NEWLINE_OR_CR; } else result = MOVE_NEWLINE_OR_CR;