* 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
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;