From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: bug#9782: 24.0.90; move-to-window-line not taking header line into account Date: Tue, 07 May 2013 05:26:43 +0400 Message-ID: <51885853.7020803@yandex.ru> References: <83mxcyuw60.fsf@gnu.org> <87haiiqwiz.fsf@yandex.ru> <83vc6yf8hr.fsf@gnu.org> <5185CB24.5060207@yandex.ru> <83sj21fmo5.fsf@gnu.org> <518725C3.10107@yandex.ru> <83bo8of4hp.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1367890037 26481 80.91.229.3 (7 May 2013 01:27:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 May 2013 01:27:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 07 03:27:15 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UZWgU-0006XG-BN for ged-emacs-devel@m.gmane.org; Tue, 07 May 2013 03:27:14 +0200 Original-Received: from localhost ([::1]:54846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZWgT-0005TH-It for ged-emacs-devel@m.gmane.org; Mon, 06 May 2013 21:27:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZWgJ-0005RB-Mz for emacs-devel@gnu.org; Mon, 06 May 2013 21:27:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZWgB-0000df-Ct for emacs-devel@gnu.org; Mon, 06 May 2013 21:27:03 -0400 Original-Received: from mail-lb0-f172.google.com ([209.85.217.172]:56756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZWg2-0000cC-ND; Mon, 06 May 2013 21:26:46 -0400 Original-Received: by mail-lb0-f172.google.com with SMTP id y6so168728lbh.31 for ; Mon, 06 May 2013 18:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding:x-antivirus:x-antivirus-status; bh=+IJ6Ipo9o3lget8mlSShegIanJCIgRhlPqFIdC59Bwg=; b=00zflheY+iBfavEJE+4KdHu/lmqEqybvBWvQGu3uDgJIBCsFMK6rjEOCEVV8EBh856 y56Pwtqwp2qZ5zKrXLXfkeRE/9C4cwsCKlXYpdK8ccXTsq+iXTg5/WN+lK2A05xnXU1F S9o9u4xI97bik4Sk3X0MBuFQMBg6sV/pZvW40EUhfas8aR1T/WQMNnAHsOyBPplWAYCo fXnaLO3eASDZC4BdKXZdj4IlRDXridsmpG1DEvt+sLP7ZF33zDS5VOxc6w3M8bkqSsUn 1dumtGuBrRYKkj3KCIhUAM+FmudeK5x3dV+g3sXd4lcNq3JFRKsOsfHabaCYl+PIeQNg pXQQ== X-Received: by 10.112.72.97 with SMTP id c1mr111300lbv.96.1367890005214; Mon, 06 May 2013 18:26:45 -0700 (PDT) Original-Received: from [127.0.0.1] ([178.252.98.87]) by mx.google.com with ESMTPSA id w9sm9419507lbe.6.2013.05.06.18.26.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 18:26:44 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: <83bo8of4hp.fsf@gnu.org> X-Antivirus: avast! (VPS 130506-1, 07.05.2013), Outbound message X-Antivirus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.217.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159381 Archived-At: On 06.05.2013 20:38, Eli Zaretskii wrote: > Perhaps we need to improve the documentation of the posn-* family of > functions, then. It is important to keep in mind that this family > serves mainly the mouse events, so its coordinate system is > window-relative. The use of columns and rows there is just to measure > in character units, rather than in pixels. But it is still > window-relative and agnostic to the header line, like the mouse is. One might think that `move-to-window-line' is also window-relative and thus agnostic to the header line (that naturally follows if we consider the header line a part of the window). To answer your old question, `(move-to-window-line 0)' would then do pretty much the same as what calling it with any other unreachable line number does - bring point as close as possible, to line 1 in this case. > I don't see company--inside-tooltip-p anywhere in today's ELPA company > package, Naturally. I only added it recently to fix an old bug. > but anyway, why do you need to use coordinates to determine > whether the mouse clicked on the pseudo-tooltip? The pseudo-tooltip > is a display or overlay string, right? So the OBJECT part of the > event's POSITION member will tell you whether you clicked on the > string or not: if it's nil, the click is on some buffer text, but if > it's the display string, the click was on that string. Ah, good, thank you. This takes care of the rows check. We still need to compare the column values to see if the click happened exactly inside the rectangle, not to the right or left of it. And in `company-select-mouse', we need the row values to find out which rectangle line was clicked (which candidate to select), so `company--row' has to agree with mouse coordinates. >> 1) Using `move-to-window-line', `vertical-motion' and a counter. > > Actually, I think you want something like > > (count-screen-lines (window-start) (point)) > > And for the mouse, see the suggestion above. Taking the above into account, I think having a header-line-aware version of `move-to-window-line' instead would be best. Like suggested before, it would adjust the argument by 1 if emacs-version >= "24", and the header line is present. It will break if/when the window can include something else on the top.