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: Eli Zaretskii
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

> Date: Tue, 07 May 2013 05:26:43 +0400
> From: Dmitry Gutov <address@hidden>
> CC: address@hidden
> 
> 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.



reply via email to

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