GNU bug report logs - #43469
28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Yuan Fu <casouri <at> gmail.com>
Subject: bug#43469: closed (Fwd: bug#43469: 28.0.50; window-text-pixel-size
 returns incorrect value when line-prefix is set)
Date: Sat, 19 Sep 2020 18:34:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 43469 <at> debbugs.gnu.org.

-- 
43469: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=43469
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: 43469-done <at> debbugs.gnu.org
Subject: Fwd: bug#43469: 28.0.50; window-text-pixel-size returns incorrect
 value when line-prefix is set
Date: Sat, 19 Sep 2020 14:33:37 -0400
[Message part 3 (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 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Bug Report Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 28.0.50; window-text-pixel-size returns incorrect value when
 line-prefix is set
Date: Thu, 17 Sep 2020 12:03:35 -0400
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))



This bug report was last modified 4 years and 305 days ago.

Previous Next


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