GNU bug report logs -
#43469
28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
Previous Next
Reported by: Yuan Fu <casouri <at> gmail.com>
Date: Thu, 17 Sep 2020 16:04:01 UTC
Severity: normal
Found in version 28.0.50
Done: Yuan Fu <casouri <at> gmail.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 43469 in the body.
You can then email your comments to 43469 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Thu, 17 Sep 2020 16:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yuan Fu <casouri <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 17 Sep 2020 16:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
To reproduce:
In scratch buffer:
(progn (insert "xxxxxxxxxxxxxx")
(print (car (window-text-pixel-size
nil (line-beginning-position) (line-end-position))))
(put-text-property (line-beginning-position) (line-end-position)
'line-prefix " ")
(print (car (window-text-pixel-size
nil (line-beginning-position) (line-end-position)))))
Prints first 98, then 119
In GNU Emacs 28.0.50 (build 8, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G2021))
of 2020-08-23 built on Brown
Repository revision: 4aff89ece6d9ceee882375879518b71ca6a89a70
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1894
System Description: Mac OS X 10.15.6
Configured using:
'configure --with-modules --with-pdumper=yes
--oldincludedir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2/
--with-ns
PKG_CONFIG_PATH=/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig'
Configured features:
PNG RSVG DBUS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS XIM NS MODULES THREADS JSON PDUMPER LCMS2
Important settings:
value of $LC_CTYPE: UTF-8
value of $LANG: en_CN.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads dbusbind kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)
Memory information:
((conses 16 44330 5709)
(symbols 48 5924 1)
(strings 32 15276 1588)
(string-bytes 1 500116)
(vectors 16 9923)
(vector-slots 8 142976 7765)
(floats 8 20 42)
(intervals 56 192 0)
(buffers 992 10))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Thu, 17 Sep 2020 17:33:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 43469 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Thu, 17 Sep 2020 12:03:35 -0400
>
> (progn (insert "xxxxxxxxxxxxxx")
> (print (car (window-text-pixel-size
> nil (line-beginning-position) (line-end-position))))
> (put-text-property (line-beginning-position) (line-end-position)
> 'line-prefix " ")
> (print (car (window-text-pixel-size
> nil (line-beginning-position) (line-end-position)))))
>
> Prints first 98, then 119
Why do you think this is a bug?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Fri, 18 Sep 2020 17:06:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 43469 <at> debbugs.gnu.org (full text, mbox):
> On Sep 17, 2020, at 1:32 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Thu, 17 Sep 2020 12:03:35 -0400
>>
>> (progn (insert "xxxxxxxxxxxxxx")
>> (print (car (window-text-pixel-size
>> nil (line-beginning-position) (line-end-position))))
>> (put-text-property (line-beginning-position) (line-end-position)
>> 'line-prefix " ")
>> (print (car (window-text-pixel-size
>> nil (line-beginning-position) (line-end-position)))))
>>
>> Prints first 98, then 119
>
> Why do you think this is a bug?
I thought the pixel width shouldn’t include the line-prefix?
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Fri, 18 Sep 2020 19:23:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 43469 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Fri, 18 Sep 2020 13:05:15 -0400
> Cc: 43469 <at> debbugs.gnu.org
>
> >> (progn (insert "xxxxxxxxxxxxxx")
> >> (print (car (window-text-pixel-size
> >> nil (line-beginning-position) (line-end-position))))
> >> (put-text-property (line-beginning-position) (line-end-position)
> >> 'line-prefix " ")
> >> (print (car (window-text-pixel-size
> >> nil (line-beginning-position) (line-end-position)))))
> >>
> >> Prints first 98, then 119
> >
> > Why do you think this is a bug?
>
> I thought the pixel width shouldn’t include the line-prefix?
It should. From the function's doc string:
This function exists to allow Lisp programs to adjust the dimensions
of WINDOW to the buffer text it needs to display.
When you want to know how wide a window you need for displaying some
text, you do want the line-prefix part accounted for.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Sat, 19 Sep 2020 18:34:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 43469 <at> debbugs.gnu.org (full text, mbox):
> On Sep 18, 2020, at 3:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> From: Yuan Fu <casouri <at> gmail.com>
>> Date: Fri, 18 Sep 2020 13:05:15 -0400
>> Cc: 43469 <at> debbugs.gnu.org
>>
>>>> (progn (insert "xxxxxxxxxxxxxx")
>>>> (print (car (window-text-pixel-size
>>>> nil (line-beginning-position) (line-end-position))))
>>>> (put-text-property (line-beginning-position) (line-end-position)
>>>> 'line-prefix " ")
>>>> (print (car (window-text-pixel-size
>>>> nil (line-beginning-position) (line-end-position)))))
>>>>
>>>> Prints first 98, then 119
>>>
>>> Why do you think this is a bug?
>>
>> I thought the pixel width shouldn’t include the line-prefix?
>
> It should. From the function's doc string:
>
> This function exists to allow Lisp programs to adjust the dimensions
> of WINDOW to the buffer text it needs to display.
>
> When you want to know how wide a window you need for displaying some
> text, you do want the line-prefix part accounted for.
I see. I managed to use (window-text-pixel-size nil (point) (point)) to calculate the prefix width and subtract it out. Thanks.
Yuan
Reply sent
to
Yuan Fu <casouri <at> gmail.com>
:
You have taken responsibility.
(Sat, 19 Sep 2020 18:34:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yuan Fu <casouri <at> gmail.com>
:
bug acknowledged by developer.
(Sat, 19 Sep 2020 18:34:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 43469-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Begin forwarded message:
>
> From: Yuan Fu <casouri <at> gmail.com>
> Subject: Re: bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
> Date: September 19, 2020 at 2:33:03 PM GMT-4
> To: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 43469 <at> debbugs.gnu.org
>
>
>
>> On Sep 18, 2020, at 3:22 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>>
>>> From: Yuan Fu <casouri <at> gmail.com>
>>> Date: Fri, 18 Sep 2020 13:05:15 -0400
>>> Cc: 43469 <at> debbugs.gnu.org
>>>
>>>>> (progn (insert "xxxxxxxxxxxxxx")
>>>>> (print (car (window-text-pixel-size
>>>>> nil (line-beginning-position) (line-end-position))))
>>>>> (put-text-property (line-beginning-position) (line-end-position)
>>>>> 'line-prefix " ")
>>>>> (print (car (window-text-pixel-size
>>>>> nil (line-beginning-position) (line-end-position)))))
>>>>>
>>>>> Prints first 98, then 119
>>>>
>>>> Why do you think this is a bug?
>>>
>>> I thought the pixel width shouldn’t include the line-prefix?
>>
>> It should. From the function's doc string:
>>
>> This function exists to allow Lisp programs to adjust the dimensions
>> of WINDOW to the buffer text it needs to display.
>>
>> When you want to know how wide a window you need for displaying some
>> text, you do want the line-prefix part accounted for.
>
> I see. I managed to use (window-text-pixel-size nil (point) (point)) to calculate the prefix width and subtract it out. Thanks.
>
> Yuan
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#43469
; Package
emacs
.
(Sat, 19 Sep 2020 18:57:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 43469-done <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Sat, 19 Sep 2020 14:33:03 -0400
> Cc: 43469 <at> debbugs.gnu.org
>
> > This function exists to allow Lisp programs to adjust the dimensions
> > of WINDOW to the buffer text it needs to display.
> >
> > When you want to know how wide a window you need for displaying some
> > text, you do want the line-prefix part accounted for.
>
> I see. I managed to use (window-text-pixel-size nil (point) (point)) to calculate the prefix width and subtract it out. Thanks.
Thanks, so I'm closing this bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 18 Oct 2020 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 246 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.