GNU bug report logs -
#18493
24.3.93; posn-col-row should take text-scale-mode into account
Previous Next
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: Dmitry <dgutov <at> yandex.ru>
> 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".
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.