[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2e7402b: Fix C-n/C-p when a line starts with an image
From: |
Eli Zaretskii |
Subject: |
master 2e7402b: Fix C-n/C-p when a line starts with an image |
Date: |
Tue, 15 Dec 2020 12:35:19 -0500 (EST) |
branch: master
commit 2e7402b760576b54a326fca593c948a73bc3d6d0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Fix C-n/C-p when a line starts with an image
* src/xdisp.c (move_it_to): Handle the case where the second call
to move_it_in_display_line_to under MOVE_TO_Y takes us farther
from TO_CHARPOS than the first call. This fixes values returned
by pos-visible-in-window-p and posn-at-point when the screen line
starts with invisible text followed by an image. (Bug#9092)
---
src/xdisp.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 699183f..0fd5ec5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9957,7 +9957,27 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int
to_x, int to_y, int to_vpos
{
skip = skip2;
if (skip == MOVE_POS_MATCH_OR_ZV)
- reached = 7;
+ {
+ reached = 7;
+ /* If the last move_it_in_display_line_to call
+ took us away from TO_CHARPOS, back up to the
+ previous position, as it is a better
+ approximation of TO_CHARPOS. (Note that we
+ could have both positions after TO_CHARPOS or
+ both positions before it, due to bidi
+ reordering.) */
+ if (IT_CHARPOS (*it) != to_charpos
+ && ((IT_CHARPOS (it_backup) > to_charpos)
+ == (IT_CHARPOS (*it) > to_charpos)))
+ {
+ int max_ascent = it->max_ascent;
+ int max_descent = it->max_descent;
+
+ RESTORE_IT (it, &it_backup, backup_data);
+ it->max_ascent = max_ascent;
+ it->max_descent = max_descent;
+ }
+ }
}
}
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2e7402b: Fix C-n/C-p when a line starts with an image,
Eli Zaretskii <=