unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: 43469@debbugs.gnu.org
Subject: bug#43469: 28.0.50; window-text-pixel-size returns incorrect value when line-prefix is set
Date: Fri, 18 Sep 2020 22:22:17 +0300	[thread overview]
Message-ID: <835z8a51qu.fsf@gnu.org> (raw)
In-Reply-To: <97950C21-6F10-4E4C-8854-BA64C023B9D6@gmail.com> (message from Yuan Fu on Fri, 18 Sep 2020 13:05:15 -0400)

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





  reply	other threads:[~2020-09-18 19:22 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 [this message]
2020-09-19 18:33       ` Yuan Fu
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=835z8a51qu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=43469@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    /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 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).