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 22:46:14 +0300

> Date: Fri, 19 Sep 2014 22:08:14 +0400
> From: Dmitry Gutov <[email-masked]>
> CC: [email-masked]
> 
> >> 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.
> 
> What I had in mind, is instead of dividing the pixel coordinates by 
> `frame-char-width', first scale it according to the text scale level.

You describe a means to get what you want, but don't explain why you
need that.  Why do you need to divide the pixel coordinates by
something?  What do you want to achieve by that division?  What are
you going to do with the 'scaled" column?

> >> 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.
> 
> I think I've described it already in previous discussions. e.g. in 
> http://debbugs.gnu.org/18195

If that were enough, I wouldn't be asking for more details.

> For better description, you could just read the code

Sorry, I don't have time for that.

I don't insist that you explain things to me, I'm trying to help you
find the way of computing whatever it is that you need.  Feel free to
give up on me.

> > 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?
> 
> Not really: for example, if there's a tab character there, the value 
> will be too imprecise (I need to know the exact column inside the tab). 

That can be computed.

> Or if there's an existing overlay there, I'd try my best to ignore it. 
> "character position" within its display string won't help me in the least.

Not sure what you mean by "ignore", but the value tells you that you
have a string there, so you can do whatever you want.