aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-12-15 19:34:16 +0200
committerEli Zaretskii2020-12-15 19:34:16 +0200
commit2e7402b760576b54a326fca593c948a73bc3d6d0 (patch)
treece2909cfa5970415aa04dbdda6aebbd352e9f6b3 /src
parentadf968b9987d6527896e82b284c9a6b2c82fa011 (diff)
downloademacs-2e7402b760576b54a326fca593c948a73bc3d6d0.tar.gz
emacs-2e7402b760576b54a326fca593c948a73bc3d6d0.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 699183f3f59..0fd5ec5ec56 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
9957 { 9957 {
9958 skip = skip2; 9958 skip = skip2;
9959 if (skip == MOVE_POS_MATCH_OR_ZV) 9959 if (skip == MOVE_POS_MATCH_OR_ZV)
9960 reached = 7; 9960 {
9961 reached = 7;
9962 /* If the last move_it_in_display_line_to call
9963 took us away from TO_CHARPOS, back up to the
9964 previous position, as it is a better
9965 approximation of TO_CHARPOS. (Note that we
9966 could have both positions after TO_CHARPOS or
9967 both positions before it, due to bidi
9968 reordering.) */
9969 if (IT_CHARPOS (*it) != to_charpos
9970 && ((IT_CHARPOS (it_backup) > to_charpos)
9971 == (IT_CHARPOS (*it) > to_charpos)))
9972 {
9973 int max_ascent = it->max_ascent;
9974 int max_descent = it->max_descent;
9975
9976 RESTORE_IT (it, &it_backup, backup_data);
9977 it->max_ascent = max_ascent;
9978 it->max_descent = max_descent;
9979 }
9980 }
9961 } 9981 }
9962 } 9982 }
9963 else 9983 else