GNU bug report logs - #18493
24.3.93; posn-col-row should take text-scale-mode into account

Previous Next

Package: emacs;

Reported by: Dmitry <dgutov <at> yandex.ru>

Date: Wed, 17 Sep 2014 22:15:02 UTC

Severity: normal

Found in version 24.3.93

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 18493 <at> debbugs.gnu.org, dgutov <at> yandex.ru
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 <drew.adams <at> oracle.com>
> 
> > 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.




This bug report was last modified 10 years and 247 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.