unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
@ 2020-09-17 16:03 Yuan Fu
  2020-09-17 17:32 ` Eli Zaretskii
  2020-09-19 18:33 ` bug#43469: Fwd: " Yuan Fu
  0 siblings, 2 replies; 7+ messages in thread
From: Yuan Fu @ 2020-09-17 16:03 UTC (permalink / raw)
  To: 43469


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))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-17 16:03 bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set Yuan Fu
@ 2020-09-17 17:32 ` Eli Zaretskii
  2020-09-18 17:05   ` Yuan Fu
  2020-09-19 18:33 ` bug#43469: Fwd: " Yuan Fu
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-09-17 17:32 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 43469

> From: Yuan Fu <casouri@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?





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-17 17:32 ` Eli Zaretskii
@ 2020-09-18 17:05   ` Yuan Fu
  2020-09-18 19:22     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2020-09-18 17:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43469



> On Sep 17, 2020, at 1:32 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-18 17:05   ` Yuan Fu
@ 2020-09-18 19:22     ` Eli Zaretskii
  2020-09-19 18:33       ` Yuan Fu
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-09-18 19:22 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 43469

> From: Yuan Fu <casouri@gmail.com>
> Date: Fri, 18 Sep 2020 13:05:15 -0400
> Cc: 43469@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-18 19:22     ` Eli Zaretskii
@ 2020-09-19 18:33       ` Yuan Fu
  2020-09-19 18:56         ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Yuan Fu @ 2020-09-19 18:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 43469



> On Sep 18, 2020, at 3:22 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Fri, 18 Sep 2020 13:05:15 -0400
>> Cc: 43469@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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: Fwd: bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-17 16:03 bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set Yuan Fu
  2020-09-17 17:32 ` Eli Zaretskii
@ 2020-09-19 18:33 ` Yuan Fu
  1 sibling, 0 replies; 7+ messages in thread
From: Yuan Fu @ 2020-09-19 18:33 UTC (permalink / raw)
  To: 43469-done

[-- Attachment #1: Type: text/plain, Size: 1547 bytes --]



> Begin forwarded message:
> 
> From: Yuan Fu <casouri@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@gnu.org>
> Cc: 43469@debbugs.gnu.org
> 
> 
> 
>> On Sep 18, 2020, at 3:22 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> 
>>> From: Yuan Fu <casouri@gmail.com>
>>> Date: Fri, 18 Sep 2020 13:05:15 -0400
>>> Cc: 43469@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
> 


[-- Attachment #2: Type: text/html, Size: 4854 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
  2020-09-19 18:33       ` Yuan Fu
@ 2020-09-19 18:56         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-09-19 18:56 UTC (permalink / raw)
  To: Yuan Fu; +Cc: 43469-done

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 19 Sep 2020 14:33:03 -0400
> Cc: 43469@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.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-19 18:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17 16:03 bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set Yuan Fu
2020-09-17 17:32 ` Eli Zaretskii
2020-09-18 17:05   ` Yuan Fu
2020-09-18 19:22     ` Eli Zaretskii
2020-09-19 18:33       ` Yuan Fu
2020-09-19 18:56         ` Eli Zaretskii
2020-09-19 18:33 ` bug#43469: Fwd: " Yuan Fu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).