bug-gnu-emacs
[Top][All Lists]
Advanced

[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:58:56 +0300

> From: Dmitry <address@hidden>
> Date: Thu, 18 Sep 2014 02:03:46 +0400
> 
> 1. M-x text-scale-increase (7 times)
> 2. Go to column 4.
> 3. (posn-col-row (posn-at-point))
> => (15 . 24)

That's the intended behavior: posn-col-row is documented to return the
coordinates of its argument in canonical character units.  And that is
what it does here.  There's no bug here.

> Alternatively, please describe how to reliably recalculate the returned
> value in the presence of text-scale-mode.

Calculate what, exactly?  The results of this function _are_ reliable.
You just cannot in general use them as the logical (a.k.a. "physical")
column and row number, i.e. the ordinal number of a character from the
line beginning and its line number relative to window-start.  You can
only use them as the real column and row if your text uses the default
face.  But once variable-size fonts, stretch glyphs, images, and other
display atrocities come into play, there's no meaningful way of
talking about "columns" and "rows" that can be used as indices into
the text.

So the answer to your question depends on what you intend to do with
the value.

> > I don't even understand why the value should change with text scale.
>
> It would solve the problem of text-scale-mode being enabled in
> buffers, where I'm getting inaccurate results from `posn-col-row'
> because of that. And by "inaccurate", I mean different from the ones
> I'd like.

Then perhaps you want posn-col-row-as-dgutov-likes-it, not posn-col-row ;-)

Seriously, though: it all depends on what you do with the results
returned by this function.  And you didn't explain what that is, so it
is hard to tell whether there is a problem, and if so, where.

IOW, please explain what is it that "you'd like".





reply via email to

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