From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#24804: 25.1; posn-at-point erroneously signals an error Date: Sat, 29 Oct 2016 13:23:59 +0300 Message-ID: <83k2crqwqo.fsf@gnu.org> References: <87k2cudhgg.fsf@hochschule-trier.de> <58123AFB.201@gmx.at> <83h97wsxi4.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1477736737 29056 195.159.176.226 (29 Oct 2016 10:25:37 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Oct 2016 10:25:37 +0000 (UTC) Cc: 24804@debbugs.gnu.org To: politza@hochschule-trier.de Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 29 12:25:33 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qp5-0004Qm-4r for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Oct 2016 12:25:11 +0200 Original-Received: from localhost ([::1]:53913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qp7-0000Gd-PP for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Oct 2016 06:25:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qp1-0000DG-HE for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2016 06:25:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qox-0004ft-H2 for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2016 06:25:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48618) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0Qox-0004fn-DB for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2016 06:25:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c0Qox-0007Lz-2J for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2016 06:25:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Oct 2016 10:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24804-submit@debbugs.gnu.org id=B24804.147773664228173 (code B ref 24804); Sat, 29 Oct 2016 10:25:02 +0000 Original-Received: (at 24804) by debbugs.gnu.org; 29 Oct 2016 10:24:02 +0000 Original-Received: from localhost ([127.0.0.1]:35783 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qny-0007KC-7o for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:24:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qnx-0007Jp-Lx for 24804@debbugs.gnu.org; Sat, 29 Oct 2016 06:24:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qno-0004Nq-Iw for 24804@debbugs.gnu.org; Sat, 29 Oct 2016 06:23:56 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49861) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qno-0004Nh-G3; Sat, 29 Oct 2016 06:23:52 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1189 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1c0Qnn-0007CH-Hs; Sat, 29 Oct 2016 06:23:51 -0400 In-reply-to: <83h97wsxi4.fsf@gnu.org> (message from Eli Zaretskii on Fri, 28 Oct 2016 11:12:19 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125104 Archived-At: > Date: Fri, 28 Oct 2016 11:12:19 +0300 > From: Eli Zaretskii > 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); }