emacs-devel
[Top][All Lists]
Advanced

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

Re: bug#9782: 24.0.90; move-to-window-line not taking header line into a


From: Dmitry Gutov
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
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5

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.



reply via email to

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