GNU bug report logs - #54862
28.1; window-text-pixel-size sometimes fails to report accurate pixel-width

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Mon, 11 Apr 2022 18:47:02 UTC

Severity: normal

Tags: moreinfo

Found in version 28.1

Done: Eli Zaretskii <eliz <at> gnu.org>

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 54862 in the body.
You can then email your comments to 54862 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#54862; Package emacs. (Mon, 11 Apr 2022 18:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <triska <at> metalevel.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 11 Apr 2022 18:47:02 GMT) Full text and rfc822 format available.

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

From: Markus Triska <triska <at> metalevel.at>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.1;
 window-text-pixel-size sometimes fails to report accurate pixel-width
Date: Mon, 11 Apr 2022 20:48:03 +0200
To reproduce this regression, please invoke Emacs with:

    $ emacs -Q

and then evaluate the following form:

    (let ((width 20))
      (= width (let* ((height (line-pixel-height))
                      (data (with-temp-buffer
                              (insert (format "P1\n%s %s\n" width height))
                              (dotimes (_ height)
                                (insert (make-string width ?1) "\n"))
                              (buffer-string))))
                 (insert " ")
                 (let ((from (point)))
                   (insert-image `(image :type pbm :data ,data :ascent center) "t")
                   (car (window-text-pixel-size nil from (point)))))))

The expected result, obtained for example in Emacs 26.1 and 27.1, is: t.

Whereas with Emacs 28.1, evaluating the form unexpectedly yields: nil.

If possible, could you please restore the previous behaviour?

Thank you and all the best,
Markus

In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
 of 2022-04-11 built on debian
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian

Configured using:
 'configure --with-gif=ifavailable --with-tiff=ifavailable
 --with-gnutls=ifavailable'

Configured features:
CAIRO FREETYPE GLIB GMP GSETTINGS JPEG LIBSELINUX LIBXML2 MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TOOLKIT_SCROLL_BARS X11
XDBE XIM XPM LUCID ZLIB





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54862; Package emacs. (Tue, 12 Apr 2022 10:36:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 54862 <at> debbugs.gnu.org
Subject: Re: bug#54862: 28.1; window-text-pixel-size sometimes fails to
 report accurate pixel-width
Date: Tue, 12 Apr 2022 12:35:01 +0200
Markus Triska <triska <at> metalevel.at> writes:

> The expected result, obtained for example in Emacs 26.1 and 27.1, is: t.
>
> Whereas with Emacs 28.1, evaluating the form unexpectedly yields: nil.

Doing 

M-: (window-text-pixel-size nil (line-beginning-position) (point))

after inserting the image into the buffer does give the correct results,
which might mean that this is display related?  But putting in a sit-for
before the window-text-pixel-size still gives 0:

(let ((width 20))
  (let* ((height (line-pixel-height))
         (data (with-temp-buffer
                 (insert (format "P1\n%s %s\n" width height))
                 (dotimes (_ height)
                   (insert (make-string width ?1) "\n"))
                 (buffer-string))))
    (insert " ")
    (let ((from (point)))
      (insert-image `(image :type pbm :data ,data :ascent center) "t")
      (sit-for 1)
      (car (window-text-pixel-size (selected-window) from (point))))))

Very odd.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54862; Package emacs. (Tue, 12 Apr 2022 14:22:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 54862 <at> debbugs.gnu.org
Subject: Re: bug#54862: 28.1;
 window-text-pixel-size sometimes fails to report accurate pixel-width
Date: Tue, 12 Apr 2022 17:21:32 +0300
> From: Markus Triska <triska <at> metalevel.at>
> Date: Mon, 11 Apr 2022 20:48:03 +0200
> 
> 
> To reproduce this regression, please invoke Emacs with:
> 
>     $ emacs -Q
> 
> and then evaluate the following form:
> 
>     (let ((width 20))
>       (= width (let* ((height (line-pixel-height))
>                       (data (with-temp-buffer
>                               (insert (format "P1\n%s %s\n" width height))
>                               (dotimes (_ height)
>                                 (insert (make-string width ?1) "\n"))
>                               (buffer-string))))
>                  (insert " ")
>                  (let ((from (point)))
>                    (insert-image `(image :type pbm :data ,data :ascent center) "t")
>                    (car (window-text-pixel-size nil from (point)))))))
> 
> The expected result, obtained for example in Emacs 26.1 and 27.1, is: t.
> 
> Whereas with Emacs 28.1, evaluating the form unexpectedly yields: nil.

Thanks, should be fixed now on the release branch and on master.




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 13 Apr 2022 03:59:02 GMT) Full text and rfc822 format available.

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Tue, 26 Apr 2022 12:05:02 GMT) Full text and rfc822 format available.

Notification sent to Markus Triska <triska <at> metalevel.at>:
bug acknowledged by developer. (Tue, 26 Apr 2022 12:05:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: triska <at> metalevel.at
Cc: 54862-done <at> debbugs.gnu.org
Subject: Re: bug#54862: 28.1;
 window-text-pixel-size sometimes fails to report accurate pixel-width
Date: Tue, 26 Apr 2022 15:04:35 +0300
> Date: Tue, 12 Apr 2022 17:21:32 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 54862 <at> debbugs.gnu.org
> 
> > From: Markus Triska <triska <at> metalevel.at>
> > Date: Mon, 11 Apr 2022 20:48:03 +0200
> > 
> > 
> > To reproduce this regression, please invoke Emacs with:
> > 
> >     $ emacs -Q
> > 
> > and then evaluate the following form:
> > 
> >     (let ((width 20))
> >       (= width (let* ((height (line-pixel-height))
> >                       (data (with-temp-buffer
> >                               (insert (format "P1\n%s %s\n" width height))
> >                               (dotimes (_ height)
> >                                 (insert (make-string width ?1) "\n"))
> >                               (buffer-string))))
> >                  (insert " ")
> >                  (let ((from (point)))
> >                    (insert-image `(image :type pbm :data ,data :ascent center) "t")
> >                    (car (window-text-pixel-size nil from (point)))))))
> > 
> > The expected result, obtained for example in Emacs 26.1 and 27.1, is: t.
> > 
> > Whereas with Emacs 28.1, evaluating the form unexpectedly yields: nil.
> 
> Thanks, should be fixed now on the release branch and on master.

No further comments for 2 weeks, so I'm boldly marking this bug done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 May 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 330 days ago.

Previous Next


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