From e5f95dc5a35a7ff655527b08d73c05cd3f6f1dc7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Feb 2010 12:47:35 -0500 Subject: [PATCH] Start working on cursor movement in continuation lines. xdisp.c (move_it_in_display_line_to): New variables prev_method and prev_pos. Compare for strict equality in --- src/ChangeLog.bidi | 7 +++++++ src/xdisp.c | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog.bidi b/src/ChangeLog.bidi index bb0823c4edb..73fd6bf8da2 100644 --- a/src/ChangeLog.bidi +++ b/src/ChangeLog.bidi @@ -1,3 +1,10 @@ +2010-02-06 Eli Zaretskii + + Start working on cursor movement in continuation lines. + * xdisp.c (move_it_in_display_line_to): New variables prev_method + and prev_pos. Compare for strict equality in + BUFFER_POS_REACHED_P. + 2010-01-30 Eli Zaretskii Fix fallout from changes to managing glyph row reversed_p flag. diff --git a/src/xdisp.c b/src/xdisp.c index e9fd8d0af4d..8f366134cea 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7009,6 +7009,8 @@ move_it_in_display_line_to (struct it *it, struct glyph_row *saved_glyph_row; struct it wrap_it, atpos_it, atx_it; int may_wrap = 0; + enum it_method prev_method = it->method; + EMACS_INT prev_pos = IT_CHARPOS (*it); /* Don't produce glyphs in produce_glyphs. */ saved_glyph_row = it->glyph_row; @@ -7026,7 +7028,7 @@ move_it_in_display_line_to (struct it *it, #define BUFFER_POS_REACHED_P() \ ((op & MOVE_TO_POS) != 0 \ && BUFFERP (it->object) \ - && IT_CHARPOS (*it) >= to_charpos \ + && IT_CHARPOS (*it) == to_charpos \ && (it->method == GET_FROM_BUFFER \ || (it->method == GET_FROM_DISPLAY_VECTOR \ && it->dpvec + it->current.dpvec_index + 1 >= it->dpend))) @@ -7050,7 +7052,14 @@ move_it_in_display_line_to (struct it *it, if ((op & MOVE_TO_POS) != 0 && BUFFERP (it->object) && it->method == GET_FROM_BUFFER - && IT_CHARPOS (*it) > to_charpos) + && (prev_method == GET_FROM_IMAGE + || prev_method == GET_FROM_STRETCH) + /* Passed TO_CHARPOS from left to right. */ + && ((prev_pos < to_charpos + && IT_CHARPOS (*it) > to_charpos) + /* Passed TO_CHARPOS from right to left. */ + || (prev_pos > to_charpos) + && IT_CHARPOS (*it) < to_charpos)) { if (it->line_wrap != WORD_WRAP || wrap_it.sp < 0) { @@ -7064,6 +7073,9 @@ move_it_in_display_line_to (struct it *it, atpos_it = *it; } + prev_method = it->method; + if (it->method == GET_FROM_BUFFER) + prev_pos = IT_CHARPOS (*it); /* Stop when ZV reached. We used to stop here when TO_CHARPOS reached as well, but that is too soon if this glyph does not fit on this line. So we handle it @@ -7329,6 +7341,8 @@ move_it_in_display_line_to (struct it *it, break; } + if (it->method == GET_FROM_BUFFER) + prev_pos = IT_CHARPOS (*it); /* The current display element has been consumed. Advance to the next. */ set_iterator_to_next (it, 1); -- 2.39.2