From: Eli Zaretskii <eliz@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 18493@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#18493: 24.3.93; posn-col-row should take text-scale-mode into account
Date: Thu, 18 Sep 2014 19:39:20 +0300 [thread overview]
Message-ID: <83sijo2893.fsf@gnu.org> (raw)
In-Reply-To: <ebad225f-4bc4-426c-a135-8d1d15551fda@default>
> Date: Thu, 18 Sep 2014 08:37:28 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: dgutov@yandex.ru, 18493@debbugs.gnu.org
>
> > > 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?
>
> I pass the column and row to `icicle-raise-Completions-frame',
> which calls (set-mouse-position (selected-frame) col row)
Then you should be fine, because set-mouse-position expects _exactly_
the "column" and "row" that posn-col-row returns. (Its doc string
could tell that more clearly, but I looked at the implementation.)
> > posn-col-row just converts [pixels] to the frame's canonical
> > character units, that's all.
>
> That's precisely the question raised in this thread (at least
> by me, and I think maybe by Dmitry). Why? Why doesn't
> (shouldn't) it take text scaling into account? What's the
> value of using the frame char size for calculating visual
> columns in the presence of text scaling?
Because in many use cases this is exactly what you want to pass to
other functions, which expect that.
> So I guess I will need to use something like this:
>
> (if (fboundp 'posn-actual-col-row)
> (posn-actual-col-row ...)
> (posn-col-row ...))
Not necessarily: posn-actual-col-row has its own quirks, see its doc
string and the discussions in bug #18384.
> But why? Why wouldn't it be TRT to have `posn-col-row' return
> the visual column, i.e., compensate for text scaling?
Because in most cases you will not be able to do anything useful with
such a "column" that you cannot do with the buffer position that is
already available in the click event and in some other posn-*
functions.
> Is there an advantage in using frame char size for it instead?
The advantage, as I see it, is that many Emacs APIs expect such units.
Of course, this is just a guess: I didn't design that function and
didn't write its first versions. But after hacking display-related
code for some time, it makes perfect sense to me.
next prev parent reply other threads:[~2014-09-18 16:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <<864mw529bx.fsf@yandex.ru>
[not found] ` <<38e6b538-3e76-472a-b371-2e74f9a14bf7@default>
[not found] ` <<541A1693.4090009@yandex.ru>
[not found] ` <<30fb9ae4-3781-4bc7-a1cf-45bf2a195929@default>
[not found] ` <<831tr92cuq.fsf@gnu.org>
2014-09-18 15:37 ` bug#18493: 24.3.93; posn-col-row should take text-scale-mode into account Drew Adams
2014-09-18 16:39 ` Eli Zaretskii [this message]
2014-09-19 1:00 ` Stefan Monnier
[not found] ` <<ebad225f-4bc4-426c-a135-8d1d15551fda@default>
[not found] ` <<83sijo2893.fsf@gnu.org>
2014-09-18 17:12 ` Drew Adams
2014-09-18 17:22 ` Eli Zaretskii
[not found] ` <<8338bp2cwf.fsf@gnu.org>
2014-09-18 15:52 ` Drew Adams
2014-09-18 17:00 ` Eli Zaretskii
2014-09-17 22:03 Dmitry
2014-09-17 22:53 ` Drew Adams
2014-09-17 23:17 ` Dmitry Gutov
2014-09-18 1:56 ` Drew Adams
2014-09-18 9:46 ` Dmitry Gutov
2014-09-18 15:37 ` Drew Adams
2014-09-18 16:50 ` Eli Zaretskii
2014-09-18 14:59 ` Eli Zaretskii
2014-09-18 9:32 ` martin rudalics
2014-09-18 9:35 ` Dmitry Gutov
2014-09-18 14:58 ` Eli Zaretskii
2014-09-18 20:55 ` Dmitry Gutov
2014-09-19 1:05 ` Stefan Monnier
2014-09-19 1:07 ` Dmitry Gutov
2014-09-19 6:11 ` Eli Zaretskii
2014-09-19 11:17 ` Dmitry Gutov
2014-09-19 13:22 ` Eli Zaretskii
2014-09-19 18:08 ` Dmitry Gutov
2014-09-19 19:46 ` Eli Zaretskii
2014-09-22 3:59 ` Dmitry Gutov
2014-09-19 14:54 ` Stefan Monnier
2014-09-19 15:43 ` Eli Zaretskii
2014-09-19 17:38 ` Dmitry Gutov
2014-09-20 1:17 ` Stefan Monnier
2014-09-22 3:59 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83sijo2893.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=18493@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=drew.adams@oracle.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.