all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 43469@debbugs.gnu.org
Subject: bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
Date: Sat, 19 Sep 2020 14:33:03 -0400	[thread overview]
Message-ID: <8EBE71CC-3AA0-4680-92FE-6B91F4E0773A@gmail.com> (raw)
In-Reply-To: <835z8a51qu.fsf@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






  reply	other threads:[~2020-09-19 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-09-19 18:56         ` Eli Zaretskii
2020-09-19 18:33 ` bug#43469: Fwd: " Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8EBE71CC-3AA0-4680-92FE-6B91F4E0773A@gmail.com \
    --to=casouri@gmail.com \
    --cc=43469@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.