From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Brahimi Saifullah Newsgroups: gmane.emacs.bugs Subject: bug#51995: 29.0.50; `string-pixel-width' depends on the current window width Date: Sat, 20 Nov 2021 18:36:46 -0300 Message-ID: <84ilwm7bm9.fsf@gmail.com> References: <84czmvbepd.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14800"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51995@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 20 22:38:17 2021 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 1moY3s-0003fV-JG for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Nov 2021 22:38:16 +0100 Original-Received: from localhost ([::1]:50694 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1moY3q-00047G-7W for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Nov 2021 16:38:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1moY3e-00046s-JN for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 16:38:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1moY3e-0000eK-BZ for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 16:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1moY3e-0000UX-7e for bug-gnu-emacs@gnu.org; Sat, 20 Nov 2021 16:38:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <84czmvbepd.fsf@gmail.com> Resent-From: Brahimi Saifullah Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Nov 2021 21:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51995 X-GNU-PR-Package: emacs Original-Received: via spool by 51995-submit@debbugs.gnu.org id=B51995.16374442221804 (code B ref 51995); Sat, 20 Nov 2021 21:38:02 +0000 Original-Received: (at 51995) by debbugs.gnu.org; 20 Nov 2021 21:37:02 +0000 Original-Received: from localhost ([127.0.0.1]:43768 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moY2g-0000Sx-2P for submit@debbugs.gnu.org; Sat, 20 Nov 2021 16:37:02 -0500 Original-Received: from mail-ua1-f47.google.com ([209.85.222.47]:39781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1moY2e-0000SW-2s for 51995@debbugs.gnu.org; Sat, 20 Nov 2021 16:37:00 -0500 Original-Received: by mail-ua1-f47.google.com with SMTP id i6so28469414uae.6 for <51995@debbugs.gnu.org>; Sat, 20 Nov 2021 13:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:from:to:cc:subject; bh=DChnpdwESNxZHL16yWs1d8cKY4/giGctacUh6mLpveQ=; b=Bnwds7frt2i0Km7O+QsfZ9tXVv+q7NyYei3u4DVUxrJHNW38qOjBtOZR1YO580RSRM 7gjPnsJqN4lquLMrYDJ9TfU0Utr9TPTKKoNF1Vw0ICJHK3k1Y7+ehXdG/gtZwQ/PsHc9 b2RDd9Ruddpk83DjB/zuYkYSUfM7j99qyBbE53gFRRAnoE0oCYgdmrhX5PB0nVSdkyqL RVV26luFd9krLdzFeDtq0m5huEmu9W/ocOJSqUeVuRjDvi+opE8avjmnlMC9aOjl56x2 NJx9M3bPSaeVe0WjtRMl/pCmnVhONaPj6WYUn4+o913bPnayOMVKyzFO4dAtgZF/RTc2 w1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:from:to:cc:subject; bh=DChnpdwESNxZHL16yWs1d8cKY4/giGctacUh6mLpveQ=; b=0Yczsx0nAUYbzIWrnW3A7vdarvJPeJTA+zPSXBLHg59Wee0yxaRJFlWOyicR1uUs8s /FPlVQeCX/T4Yv0SEPm1lb7PVDi5VG91DrhNFnmn5cVJPCR0PnDxKyOoQuBKkG0qg4+n HeJ/sVY3SH0iedfgVxg9NvG9djzoncO8LzYeFwCKoVirk/KXXVX1PqaNjTpPJEu0r8zt Hu2xlrXZpLu6+nQwlVUpwc4Q7X2/NDe9wBA6YgV+0y4zkM18gdzFW0jTYuHRIR8mv4FD 7Tn9D/y9Hv2Y3CcUetD6npzr6UP/CgKUUMZPUgVjxxeQbbB3XMfIb1p7I0Y/4lWdf4rv OrYg== X-Gm-Message-State: AOAM532hNFYxKG0KlLB0MGan8zXVGQ3xfza/H2aEjTDMPP4rz78BiqHs rfyP2Iv+7pIcoeFGJ81ipTE78cqQulzKCnBj X-Google-Smtp-Source: ABdhPJxGzQEEwZf7+IkqM/drmrxfrRkc3JWcoMLopmxZXXLAcGr9e4xlmesxUrWiQ757V+cY6VL6KQ== X-Received: by 2002:a05:6102:3ec3:: with SMTP id n3mr112360241vsv.48.1637444214316; Sat, 20 Nov 2021 13:36:54 -0800 (PST) Original-Received: from COMPUTADOR ([2804:14d:90bc:8726:6928:8009:bb3:aa5f]) by smtp.googlemail.com with ESMTPSA id g28sm1934121vkl.16.2021.11.20.13.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Nov 2021 13:36:53 -0800 (PST) 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:220522 Archived-At: >What is the actual real-life situation where >this is needed? Mainly when a window with delicated alignment is resized. Indeed, in most situations it likely won't be an issue, but I can think of times when it most definitely will: For example, in the package I'm working on, I want certain text to always be centered, even if the user resizes the window. (By centered I mean having the same amount of space on both sides). This is a mockup of the code I use: (let* ((string "Hello World, Hello World, Hello world") (width (string-pixel-width string))) (insert (propertize " " 'display `(space :align-to (- center (,(/ width 2))))) string)) If you evaluate this code in a window that is bigger or equal to the size of the string, it will be properly aligned even if you resize it later. But if you evaluate it in a small window, it will be grossly misaligned when you increase the window size.