Subject: Re: bug#18493: 24.3.93; posn-col-row should take text-scale-mode into account

From: Eli Zaretskii <[email-masked]>
Date: Fri, 19 Sep 2014 16:22:49 +0300

> From: Dmitry Gutov <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 19 Sep 2014 15:17:09 +0400
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> > Is company-mode only for buffers whose major mode is some programming
> > language?
> 
> I'd say it's the first priority.

For you.  Then someone else will come and argue that Gnus or Org or
whatever buffers are much more important.

> I'd like to reiterate here, that I'd be satisfied just with some
> instructions how to convert the current `posn-col-row' return value
> into value that respects text scale.

I still don't understand enough what that means to answer, sorry.  See
below.

> > So what you actually need is to find the correct X coordinate for the
> > screen line _below_ (and maybe also above) the one where posn-col-row
> > is called, is that right?
> 
> I don't understand the distinction.

The distinction is this: do you need the column to access text in the
same display line, or do you need it for other display lines, like for
aligning text in the next or previous lines with the text of the line
where you called posn-col-row?

> But from `posn-col-row' I actually take the screen column value

And do what with it?  Please be specific, and please don't spare me
the details.  I don't have your knowledge of what company-mode does to
answer these questions myself, and I have only a very vague idea of
how you arrange the display of the completion candidates and how the
"column" reported by posn-col-row enters that picture.

> > If so, first question is why not do all this in pixels?
> 
> Because we use the returned value when combining the display string for
> the overlay. So at some point the pixels have to get converted to
> character numbers, and we're back to the same problem.

I still don't understand this well enough, please give the details.

E.g., given arbitrary pixel coordinates, posn-at-x-y will give you the
object at those coordinates and character position within that object.
Is that what you need?