bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24804: 25.1; posn-at-point erroneously signals an error


From: Eli Zaretskii
Subject: bug#24804: 25.1; posn-at-point erroneously signals an error
Date: Fri, 28 Oct 2016 11:12:19 +0300

> Date: Thu, 27 Oct 2016 19:35:55 +0200
> From: martin rudalics <address@hidden>
> 
>  > The documentation of the function posn-at-point states
>  >
>  > "Return nil if position is not visible in window.",
>  >
>  > but it may also signal an error in this case.  This happens, if
>  > Fpos_visible_in_window_p returns a list of (X Y RTOP RBOT ROWH VPOS)
>  > and at least Y is negative (which indicates, that pos is not visible
>  > IIUC).  The error is then signaled by Fposn_at_x_y, which only accpets
>  > non-negative numbers (neglecting the exceptional case of -1 for X).
>  >
>  > I think this function should include a similar test for y, as is already
>  > in place for x, returning nil if it is negative (see below).
> 
> Thanks.  But according to Eli the problem is in Fpos_visible_in_window_p
> which should never return a negative y in the first place.

Maybe it could, when an image is vscrolled?

In any case, the proposed patch is IMO incorrect: when point is at a
large image (or even a character glyph that's very tall relative to
its window's height), this patch will pretend that point is invisible,
whereas in fact it's partially visible (as is clear from the use case
discussed here).

The key to understanding why the patch is wrong is to remember that
the Y coordinate of a glyph on display is the coordinate of the top of
the glyph.  For a large glyph, its top can be off-screen, but most of
it could still be visible.  This is evident in the value returned by
pos-visible-in-window-p in this case: (747 -36 36 6 925 0).  It
exactly means that the image starts 36 pixels above the window top
(and ends 6 pixels below its bottom).

Perhaps if RTOP is non-nil, we should pass Y + RTOP to posn-at-x-y.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]