unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <51885853.7020803@yandex.ru> (raw)
In-Reply-To: <83bo8of4hp.fsf@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).

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	other threads:[~2013-05-07  1:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m2hb361p8e.fsf@ibookg4-c2.pc.gwdg.de>
     [not found] ` <E1RGADD-0008JI-Ht@fencepost.gnu.org>
     [not found]   ` <m28voi1iqe.fsf@ibookg4-c2.pc.gwdg.de>
     [not found]     ` <83mxcyuw60.fsf@gnu.org>
2013-05-04 21:12       ` bug#9782: 24.0.90; move-to-window-line not taking header line into account Dmitry Gutov
2013-05-05  2:47         ` Eli Zaretskii
2013-05-05  2:59           ` Dmitry Gutov
2013-05-05 15:53             ` Eli Zaretskii
2013-05-06  3:38               ` Dmitry Gutov
2013-05-06 16:38                 ` Eli Zaretskii
2013-05-07  1:26                   ` Dmitry Gutov [this message]
2013-05-07  2:54                     ` Eli Zaretskii
2013-05-07  7:41                       ` Dmitry Gutov
2013-05-07 16:50                         ` Eli Zaretskii
2013-05-07 17:19                           ` Dmitry Gutov
2014-08-15 23:33                             ` Dmitry Gutov
2014-08-16  8:03                               ` Eli Zaretskii
2014-08-16  8:27                                 ` Dmitry Gutov
2014-08-16 11:12                                   ` Eli Zaretskii
2014-08-19  4:51                                     ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51885853.7020803@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).