[Top][All Lists]

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

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

From: Eli Zaretskii
Subject: bug#18493: 24.3.93; posn-col-row should take text-scale-mode into account
Date: Thu, 18 Sep 2014 17:59:57 +0300

> Date: Wed, 17 Sep 2014 18:56:10 -0700 (PDT)
> From: Drew Adams <address@hidden>
> > Probably none. Do you have code that calls `posn-col-row', though?
> It doesn't matter whether I do or don't.  As a matter of fact, I do,
> but only a little bit - getting the column of a mouse click, using:
>  (car (posn-col-row (event-start event)))
> And I guess that code must be broken wrt text scaling.  I didn't
> realize that.

As I wrote elsewhere, whether it is broken depends on what you do with
the results.  E.g., if you deal with mouse clicks, the natural value
to use is the underlying buffer position, not column/row.  What do you
need the column for?

> > Does it have explicit support for text scaling?
> No, my code does not.  From what I understand now, I guess it
> needs to worry about that now.  Seems nuts that it should have to,
> but my understanding is limited...

Welcome to the brave new world of variable-size characters and other
Emacs display features that break the "normal" interpretation of
"columns" and "rows".  The only reliable way of expressing screen
coordinates in the general case is with pixel values.  posn-col-row
just converts that to the frame's canonical character units, that's
all.  We have other functions which map that to buffer position or to
other objects if the click event is not on buffer text.  The question
is what you do with what posn-col-row returns.  Given the answer, it
should be possible to tell you how to get at the information even when
such advanced display features are in use, or maybe identify some
missing Emacs functionality.

reply via email to

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