all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: politza@hochschule-trier.de
Cc: 24804@debbugs.gnu.org
Subject: bug#24804: 25.1; posn-at-point erroneously signals an error
Date: Sat, 29 Oct 2016 13:23:59 +0300	[thread overview]
Message-ID: <83k2crqwqo.fsf@gnu.org> (raw)
In-Reply-To: <83h97wsxi4.fsf@gnu.org> (message from Eli Zaretskii on Fri, 28 Oct 2016 11:12:19 +0300)

> Date: Fri, 28 Oct 2016 11:12:19 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 24804@debbugs.gnu.org, politza@hochschule-trier.de
> 
> > 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.

Andreas, can you try the patch below?  Thanks.

diff --git a/src/keyboard.c b/src/keyboard.c
index bb411e7..65938a5 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10790,11 +10790,19 @@ The `posn-' functions access elements of such lists.  */)
     {
       Lisp_Object x = XCAR (tem);
       Lisp_Object y = XCAR (XCDR (tem));
+      Lisp_Object aux_info = XCDR (XCDR (tem));
+      int y_coord = XINT (y);
 
       /* Point invisible due to hscrolling?  X can be -1 when a
 	 newline in a R2L line overflows into the left fringe.  */
       if (XINT (x) < -1)
 	return Qnil;
+      if (!NILP (aux_info) && y_coord < 0)
+	{
+	  int rtop = XINT (XCAR (aux_info));
+
+	  y = make_number (y_coord + rtop);
+	}
       tem = Fposn_at_x_y (x, y, window, Qnil);
     }
 





  reply	other threads:[~2016-10-29 10:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 19:43 bug#24804: 25.1; posn-at-point erroneously signals an error Andreas Politz
     [not found] ` <handler.24804.B.147751104225420.ack@debbugs.gnu.org>
2016-10-26 19:49   ` bug#24804: Acknowledgement (25.1; posn-at-point erroneously signals an error) Andreas Politz
2016-10-27 17:35 ` bug#24804: 25.1; posn-at-point erroneously signals an error martin rudalics
2016-10-27 18:26   ` Andreas Politz
2016-10-28  8:12   ` Eli Zaretskii
2016-10-29 10:23     ` Eli Zaretskii [this message]
2016-10-29 14:26       ` Andreas Politz
2016-10-29 14:36         ` Eli Zaretskii
2016-10-29 14:42           ` Eli Zaretskii
2016-10-29 20:33             ` Andreas Politz
2016-10-29 22:03               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83k2crqwqo.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=24804@debbugs.gnu.org \
    --cc=politza@hochschule-trier.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.