From 979022ef177beb0022838f6b49da6632cd0d3414 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 31 Mar 2012 22:30:53 +0300 Subject: [PATCH] Fix bug #11063 with move_it_by_lines when there's a before-string at bol. src/xdisp.c (move_it_by_lines): When DVPOS is positive, and the position we get to after a call to move_it_to fails the IS_POS_VALID_AFTER_MOVE_P test, move to the next buffer position only if we wind up in a string from display property. --- src/ChangeLog | 5 +++++ src/xdisp.c | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 33c93a30b08..9be289c42bb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2012-03-31 Eli Zaretskii + * xdisp.c (move_it_by_lines): When DVPOS is positive, and the + position we get to after a call to move_it_to fails the + IS_POS_VALID_AFTER_MOVE_P test, move to the next buffer position + only if we wind up in a string from display property. (Bug#11063) + * window.c (Fdelete_other_windows_internal): Invalidate the row and column information about mouse highlight, so that redisplay restores it after reallocating the glyph matrices. (Bug#7464) diff --git a/src/xdisp.c b/src/xdisp.c index 54379a2e99f..dcd14a1792a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -8973,7 +8973,20 @@ move_it_by_lines (struct it *it, int dvpos) { move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); if (!IT_POS_VALID_AFTER_MOVE_P (it)) - move_it_to (it, IT_CHARPOS (*it) + 1, -1, -1, -1, MOVE_TO_POS); + { + /* Only move to the next buffer position if we ended up in a + string from display property, not in an overlay string + (before-string or after-string). That is because the + latter don't conceal the underlying buffer position, so + we can ask to move the iterator to the exact position we + are interested in. Note that, even if we are already at + IT_CHARPOS (*it), the call below is not a no-op, as it + will detect that we are at the end of the string, pop the + iterator, and compute it->current_x and it->hpos + correctly. */ + move_it_to (it, IT_CHARPOS (*it) + it->string_from_display_prop_p, + -1, -1, -1, MOVE_TO_POS); + } } else { -- 2.39.2