From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii 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:54:02 +0300 Message-ID: <83txmfebzp.fsf@gnu.org> 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> <51885853.7020803@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1367895274 9214 80.91.229.3 (7 May 2013 02:54:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 May 2013 02:54:34 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 07 04:54:33 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 1UZY2y-0007la-6N for ged-emacs-devel@m.gmane.org; Tue, 07 May 2013 04:54:32 +0200 Original-Received: from localhost ([::1]:34662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZY2x-0006WD-F1 for ged-emacs-devel@m.gmane.org; Mon, 06 May 2013 22:54:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZY2p-0006W7-KW for emacs-devel@gnu.org; Mon, 06 May 2013 22:54:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZY2k-00015h-So for emacs-devel@gnu.org; Mon, 06 May 2013 22:54:23 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:40028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZY2k-00014o-KF for emacs-devel@gnu.org; Mon, 06 May 2013 22:54:18 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0MME00E00QOUWC00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Tue, 07 May 2013 05:54:10 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MME00ETIQQ9FGB0@a-mtaout22.012.net.il>; Tue, 07 May 2013 05:54:10 +0300 (IDT) In-reply-to: <51885853.7020803@yandex.ru> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.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:159383 Archived-At: > Date: Tue, 07 May 2013 05:26:43 +0400 > From: Dmitry Gutov > CC: emacs-devel@gnu.org > > 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). "Line" is a line of text, and move-to-window-line was written to go to a line of text. > > 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. Doesn't the overlay cover the entire rectangle? > And in `company-select-mouse', we need the row values to find out which > rectangle line was clicked (which candidate to select) Isn't each rectangle a different string? > > 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. ??? But you don't want to _move_ anywhere, AFAIU. You want to compute a window-relative screen line number of a given position (I used point in the above example, but that can be replaced by any buffer position). So how does move-to-window-line fit that bill? Its return value is undocumented, so you cannot really rely on that. > Like suggested before, it would adjust the argument by 1 if > emacs-version >= "24", and the header line is present. The function move-to-window-line is implemented in C, so it is pointless to make it sensitive to Emacs version.