From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#43469: 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-ID: <15D4649C-A7E0-4269-9CE8-904B9DAC6A23@gmail.com> References: <8EBE71CC-3AA0-4680-92FE-6B91F4E0773A@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_4B0FA449-06F2-4678-A544-CC0FE798CC33" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17490"; mail-complaints-to="usenet@ciao.gmane.io" To: 43469-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 19 20:34:25 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kJhgl-0004O6-0E for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 20:34:23 +0200 Original-Received: from localhost ([::1]:55624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJhgk-00020N-32 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Sep 2020 14:34:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJhgR-0001vP-1C for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 14:34:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJhgQ-0008Ue-MC for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 14:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJhgQ-0005dn-KG for bug-gnu-emacs@gnu.org; Sat, 19 Sep 2020 14:34:02 -0400 In-Reply-To: Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Sep 2020 18:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 43469 X-GNU-PR-Package: emacs Mail-Followup-To: 43469@debbugs.gnu.org, casouri@gmail.com, casouri@gmail.com Original-Received: via spool by 43469-done@debbugs.gnu.org id=D43469.160054042621650 (code D ref 43469); Sat, 19 Sep 2020 18:34:02 +0000 Original-Received: (at 43469-done) by debbugs.gnu.org; 19 Sep 2020 18:33:46 +0000 Original-Received: from localhost ([127.0.0.1]:48102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJhg9-0005d8-Md for submit@debbugs.gnu.org; Sat, 19 Sep 2020 14:33:46 -0400 Original-Received: from mail-qt1-f169.google.com ([209.85.160.169]:44092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJhg8-0005cu-7B for 43469-done@debbugs.gnu.org; Sat, 19 Sep 2020 14:33:44 -0400 Original-Received: by mail-qt1-f169.google.com with SMTP id e7so8433317qtj.11 for <43469-done@debbugs.gnu.org>; Sat, 19 Sep 2020 11:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:mime-version:subject:message-id:references:to:date; bh=KGoiJ8cNgCFg7oLWOFJ8Fqj4DIYX/fd8taZxiBpB9bE=; b=pEiimS9jiN/wHXmBPFVB2NBnFmimDPuHfLs0R6AH0591Jo6jsdqa1dhHj21Y/mBYfk KBUHbBLsaXZnbtsqTgM3weouqZO+dKsocrxGWgPo8tRkqPvN2Cx+YOoHBIKUA+sAYSDE h+VaM8OqyF5DaKrKsdB6SxP66Kfs8JOSAqjgPPLb1t5Zc1hJOJ5sPRCC+/3kaFjRf2jH Kg7c8dfDknknrcqdbFDyRCRTlWwNmwx4aMzLXCpA426usmubTaIYQ+wo2wEQKEhF1dKs riIReEbT6Aa5lUMza8ONuTcAW4/48apFpZK8idF4FB/pR/e6VsZYd3aFYcWpvXa8dovz UauA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:mime-version:subject:message-id:references :to:date; bh=KGoiJ8cNgCFg7oLWOFJ8Fqj4DIYX/fd8taZxiBpB9bE=; b=oUerpJwJQ5xQ0ktHgeTqN+tUiz5jH3Go1Fv3s71HDFuy9fUiUzaPrPgWnZivum8NoN IOCwU821f8fVSZBHVawvfJLvnglo+F719dfxmtFvBMWkBVArqir9asxDzb9nv934j+tT +Q9HQONRl30fbFtXaSseHFB6qSNuA1aVTTw8MwoOdhbEVYjw99jC/HZn9EAjKlh9jkXa jNI+5rCERyCj047VRQwrdtWp9QdXd6P6bM/ThtxpOLP1jeB5PXbGkzq11tyCJuf6WvnZ NRQ3OObjXM6r4ZCbQkTRvivJOiEb4EldH77Q5bvi+lEJVjO1rW7gCLcDZnaU66JbF5mx 32oQ== X-Gm-Message-State: AOAM530I0JqBGjqS/AHQDAmj2WDLj2CaYx17A94X5lHQXA+VWiKsgVYd H8bzqaW/Y+Qxq413ZfihZ/igWCzidZp5eUYJ X-Google-Smtp-Source: ABdhPJwSxu0LMZB2InA734AlhSB4g/itvSjTKpQBy3SY/dlS+EbAmuxK/Y56Acl4SkcUiiUpOLqMmQ== X-Received: by 2002:ac8:f23:: with SMTP id e32mr26434903qtk.168.1600540418561; Sat, 19 Sep 2020 11:33:38 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:6549:b792:5f47:6486? ([2601:98a:4200:9210:6549:b792:5f47:6486]) by smtp.gmail.com with ESMTPSA id m196sm5026150qke.87.2020.09.19.11.33.37 for <43469-done@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Sep 2020 11:33:38 -0700 (PDT) X-Mailer: Apple Mail (2.3608.120.23.2.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:188427 Archived-At: --Apple-Mail=_4B0FA449-06F2-4678-A544-CC0FE798CC33 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Begin forwarded message: >=20 > From: Yuan Fu > 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 > Cc: 43469@debbugs.gnu.org >=20 >=20 >=20 >> On Sep 18, 2020, at 3:22 PM, Eli Zaretskii wrote: >>=20 >>> From: Yuan Fu >>> Date: Fri, 18 Sep 2020 13:05:15 -0400 >>> Cc: 43469@debbugs.gnu.org >>>=20 >>>>> (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))))) >>>>>=20 >>>>> Prints first 98, then 119 >>>>=20 >>>> Why do you think this is a bug? >>>=20 >>> I thought the pixel width shouldn=E2=80=99t include the line-prefix? >>=20 >> It should. =46rom the function's doc string: >>=20 >> This function exists to allow Lisp programs to adjust the dimensions >> of WINDOW to the buffer text it needs to display. >>=20 >> When you want to know how wide a window you need for displaying some >> text, you do want the line-prefix part accounted for. >=20 > I see. I managed to use (window-text-pixel-size nil (point) (point)) = to calculate the prefix width and subtract it out. Thanks. >=20 > Yuan >=20 --Apple-Mail=_4B0FA449-06F2-4678-A544-CC0FE798CC33 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

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>



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
= =             &n= bsp;    nil (line-beginning-position) = (line-end-position))))
=     (put-text-property (line-beginning-position) = (line-end-position)
=             &n= bsp;          'line-pref= ix "   ")
    (print (car = (window-text-pixel-size
=             &n= bsp;    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=E2=80=99t include the line-prefix?

It should.  =46rom 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


= --Apple-Mail=_4B0FA449-06F2-4678-A544-CC0FE798CC33--