GNU bug report logs - #52142
28.0.60; `posn-object-width-height' does not reflect actual dimensions of object when confronted by display string

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Sat, 27 Nov 2021 12:01:02 UTC

Severity: normal

Tags: notabug

Found in version 28.0.60

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52142 in the body.
You can then email your comments to 52142 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52142; Package emacs. (Sat, 27 Nov 2021 12:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Po Lu <luangruo <at> yahoo.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Nov 2021 12:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.60; `posn-object-width-height' does not reflect actual
 dimensions of object when confronted by display string
Date: Sat, 27 Nov 2021 20:00:17 +0800
In Emacs -Q, run M-x report-emacs-bug RET, move point to the message
intended for novices (This bug report will be sent to the Bug-GNU-Emacs
mailing list ...), and then evaluate (posn-at-point) there.

The posn-object of the position list will be the display string
containing the entire message, but the posn-object-width-height will
contain the dimensions of the first character of the message, in this
case "T".

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52142; Package emacs. (Sat, 27 Nov 2021 12:33:02 GMT) Full text and rfc822 format available.

Message #8 received at 52142 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 52142 <at> debbugs.gnu.org
Subject: Re: bug#52142: 28.0.60;
 `posn-object-width-height' does not reflect actual dimensions of
 object when confronted by display string
Date: Sat, 27 Nov 2021 14:32:42 +0200
tags 52142 notabug
thanks

> Date: Sat, 27 Nov 2021 20:00:17 +0800
> From:  Po Lu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> In Emacs -Q, run M-x report-emacs-bug RET, move point to the message
> intended for novices (This bug report will be sent to the Bug-GNU-Emacs
> mailing list ...), and then evaluate (posn-at-point) there.
> 
> The posn-object of the position list will be the display string
> containing the entire message, but the posn-object-width-height will
> contain the dimensions of the first character of the message, in this
> case "T".

That's a feature.  Maybe it isn't documented clearly enough, but
basically as long as there's a character displayed at that position,
WIDTH and HEIGHT give the dimensions of that character's glyph on
display.

Remember: this stuff was originally designed for mouse clicks, where
it's important to know what did you click on.




Added tag(s) notabug. Request was from Eli Zaretskii <eliz <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 27 Nov 2021 12:33:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52142; Package emacs. (Sat, 27 Nov 2021 12:48:02 GMT) Full text and rfc822 format available.

Message #13 received at 52142 <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52142 <at> debbugs.gnu.org
Subject: Re: bug#52142: 28.0.60; `posn-object-width-height' does not reflect
 actual dimensions of object when confronted by display string
Date: Sat, 27 Nov 2021 20:47:07 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> That's a feature.  Maybe it isn't documented clearly enough, but
> basically as long as there's a character displayed at that position,
> WIDTH and HEIGHT give the dimensions of that character's glyph on
> display.

Hmm, okay.  I think the documentation in (elisp)Click Events could do
with some improvement:

WIDTH, HEIGHT
     These are the pixel width and height of OBJECT or, if this is
     ‘nil’, those of the character glyph clicked on.

   For clicks on a scroll bar, POSITION has this form:

     (WINDOW AREA (PORTION . WHOLE) TIMESTAMP PART)

Should probably be

WIDTH, HEIGHT
     These are the pixel width and height of the character glyph clicked
     on, or, if none exists, the pixel width and height of OBJECT.

   For clicks on a scroll bar, POSITION has this form:

     (WINDOW AREA (PORTION . WHOLE) TIMESTAMP PART)


> Remember: this stuff was originally designed for mouse clicks, where
> it's important to know what did you click on.

Thanks.  On a slightly unrelated topic, what would be the appropriate
method to obtain the height of such a display string?  I'm trying to
make the pixel scrolling machinery work with such text, and while
scrolling down already works, I have no idea how to implement scrolling
up, which currently relies on going to the last screen line, then
adjusting vscroll the remainder of the way, which naturally requires a
way to fetch the height of the display string.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52142; Package emacs. (Sat, 27 Nov 2021 13:04:01 GMT) Full text and rfc822 format available.

Message #16 received at 52142 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 52142 <at> debbugs.gnu.org
Subject: Re: bug#52142: 28.0.60; `posn-object-width-height' does not reflect
 actual dimensions of object when confronted by display string
Date: Sat, 27 Nov 2021 15:03:11 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 52142 <at> debbugs.gnu.org
> Date: Sat, 27 Nov 2021 20:47:07 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > That's a feature.  Maybe it isn't documented clearly enough, but
> > basically as long as there's a character displayed at that position,
> > WIDTH and HEIGHT give the dimensions of that character's glyph on
> > display.
> 
> Hmm, okay.  I think the documentation in (elisp)Click Events could do
> with some improvement:

Thanks, fixed.

> > Remember: this stuff was originally designed for mouse clicks, where
> > it's important to know what did you click on.
> 
> Thanks.  On a slightly unrelated topic, what would be the appropriate
> method to obtain the height of such a display string?  I'm trying to
> make the pixel scrolling machinery work with such text, and while
> scrolling down already works, I have no idea how to implement scrolling
> up, which currently relies on going to the last screen line, then
> adjusting vscroll the remainder of the way, which naturally requires a
> way to fetch the height of the display string.

Did you try window-text-pixel-size?




Reply sent to Po Lu <luangruo <at> yahoo.com>:
You have taken responsibility. (Sat, 27 Nov 2021 13:14:01 GMT) Full text and rfc822 format available.

Notification sent to Po Lu <luangruo <at> yahoo.com>:
bug acknowledged by developer. (Sat, 27 Nov 2021 13:14:01 GMT) Full text and rfc822 format available.

Message #21 received at 52142-done <at> debbugs.gnu.org (full text, mbox):

From: Po Lu <luangruo <at> yahoo.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 52142-done <at> debbugs.gnu.org
Subject: Re: bug#52142: 28.0.60; `posn-object-width-height' does not reflect
 actual dimensions of object when confronted by display string
Date: Sat, 27 Nov 2021 21:12:55 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

> Thanks, fixed.

I think it's OK to close this bug now then.

> Did you try window-text-pixel-size?

No, for whatever reason I assumed it would not work for text displayed
this way.  I will try it.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52142; Package emacs. (Sat, 27 Nov 2021 13:29:01 GMT) Full text and rfc822 format available.

Message #24 received at 52142 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 52142 <at> debbugs.gnu.org
Subject: Re: bug#52142: 28.0.60; `posn-object-width-height' does not reflect
 actual dimensions of object when confronted by display string
Date: Sat, 27 Nov 2021 15:27:32 +0200
> From: Po Lu <luangruo <at> yahoo.com>
> Cc: 52142-done <at> debbugs.gnu.org
> Date: Sat, 27 Nov 2021 21:12:55 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Thanks, fixed.
> 
> I think it's OK to close this bug now then.
> 
> > Did you try window-text-pixel-size?
> 
> No, for whatever reason I assumed it would not work for text displayed
> this way.

window-text-pixel-size is actually supposed to work in more cases than
posn-at-point, since it doesn't require the text to be visible (or
even displayed).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Dec 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 122 days ago.

Previous Next


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