mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 18:00:40 -08:00
Fix 'posn-at-point' near some overlays
* src/xdisp.c (pos_visible_p): Fix 'posn-at-point' for positions just after a display property that draws a fringe bitmap. (Bug#52097)
This commit is contained in:
parent
d1aa552d11
commit
a22c9a34bd
1 changed files with 18 additions and 2 deletions
20
src/xdisp.c
20
src/xdisp.c
|
|
@ -1992,7 +1992,17 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
|
|||
}
|
||||
|
||||
*x = top_x;
|
||||
*y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
|
||||
/* The condition below is a heuristic fix for the situation
|
||||
where move_it_to stops just after finishing the display
|
||||
of a fringe bitmap, which resets it.ascent to zero, and
|
||||
thus causes Y to be offset by it.max_ascent. */
|
||||
if (it.ascent == 0 && it.what == IT_IMAGE
|
||||
&& it.method != GET_FROM_IMAGE
|
||||
&& it.image_id < 0
|
||||
&& it.max_ascent > 0)
|
||||
*y = max (top_y, window_top_y);
|
||||
else
|
||||
*y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y);
|
||||
*rtop = max (0, window_top_y - top_y);
|
||||
*rbot = max (0, bottom_y - it.last_visible_y);
|
||||
*rowh = max (0, (min (bottom_y, it.last_visible_y)
|
||||
|
|
@ -2020,7 +2030,13 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
|
|||
RESTORE_IT (&it2, &it2, it2data);
|
||||
move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS);
|
||||
*x = it2.current_x;
|
||||
*y = it2.current_y + it2.max_ascent - it2.ascent;
|
||||
if (it2.ascent == 0 && it2.what == IT_IMAGE
|
||||
&& it2.method != GET_FROM_IMAGE
|
||||
&& it2.image_id < 0
|
||||
&& it2.max_ascent > 0)
|
||||
*y = it2.current_y;
|
||||
else
|
||||
*y = it2.current_y + it2.max_ascent - it2.ascent;
|
||||
*rtop = max (0, -it2.current_y);
|
||||
*rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent)
|
||||
- it.last_visible_y));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue