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: Sun, 21 Nov 2021 15:38:05 -0300 Message-ID: <84ee79xsky.fsf@gmail.com> References: <84czmvbepd.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22921"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51995@debbugs.gnu.org To: Eli Zaretskii , martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 21 19:39:38 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 1morkY-0005mp-Je for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Nov 2021 19:39:38 +0100 Original-Received: from localhost ([::1]:48118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1morkX-00083L-8O for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Nov 2021 13:39:37 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1morjz-00082Q-Ht for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 13:39:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34456) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1morjy-0004AZ-Pt for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 13:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1morjy-0003KB-GZ for bug-gnu-emacs@gnu.org; Sun, 21 Nov 2021 13:39: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: Sun, 21 Nov 2021 18:39: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.163751989812727 (code B ref 51995); Sun, 21 Nov 2021 18:39:02 +0000 Original-Received: (at 51995) by debbugs.gnu.org; 21 Nov 2021 18:38:18 +0000 Original-Received: from localhost ([127.0.0.1]:46002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1morjG-0003JD-Ga for submit@debbugs.gnu.org; Sun, 21 Nov 2021 13:38:18 -0500 Original-Received: from mail-ua1-f49.google.com ([209.85.222.49]:44762) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1morjF-0003J0-Vd for 51995@debbugs.gnu.org; Sun, 21 Nov 2021 13:38:18 -0500 Original-Received: by mail-ua1-f49.google.com with SMTP id p2so32013053uad.11 for <51995@debbugs.gnu.org>; Sun, 21 Nov 2021 10:38:17 -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=m4zzSKzqC9JI2XCsPpNYKCR6e0VJg/7OO3PWL4b3Y5k=; b=FudlXPqkUZKY53KXhmMcSdI4qEoyH8m/TYc0YM5TStTjgIot0tmU2tvXeaF8GU8wKG mcjmGqN6MbIvLYkYirwa73tvRdKfJAMdHI45mt901znZNcq+9RMSBmf4B2uaLkmRnc8l LmcJMoeVpfjyaN7idS1hhUabspk5Ew5I70dBUIdPhXKf4Bwc+tCRvoRo9GjKQl5/M/BM MTtG+Ze8S3vMLb+Hvw92yu7Wyg40ASrnE4eIaolipRLNDvq9B+ufMDniKJdZgNl52KXd Nt8oAgAtku1HRRI4fnqsgSNfz34W37/mQLi+y/sWlgyV+jrLNSCn+70VGH8vYnCSBqf2 SDmQ== 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=m4zzSKzqC9JI2XCsPpNYKCR6e0VJg/7OO3PWL4b3Y5k=; b=zH+K/H58kivch3Y4+kBW8ZvE2D1igr0aVAFrW9y2ybZ8OqNI0WAQ0juNJ6PvzPrDr+ Dy5VqIjgjwiLN6m08UHL1zJJsFMOPGXfDjYmzU4y/7v4K4LwXdWYOZUlc9hrJVb0XrqC KkUe0SUch2GOwZrgHf13sSNNqUC5d7E0zyAswCa46Lx1BY5p7KV+AURaR5BqBRvirduw juNpfa/2qPWbwxjqZA8NDxJ9OfqG7JDjWo5jORx8mZHnVj9+GI+a959zYV34bnyyNGHy oO7gHmUEJj5CdKVXBu7lijlW/3sK1bBYeQeabgKhu0j3OmOAvc/iurMZp7YQdgCozzy+ w7WQ== X-Gm-Message-State: AOAM531fsKOLN4LLsAG/JU5cyyEHJyNmiyUQhST+HQXGh5wHnpgmkdCf 6j3nqWYpA2bZEiYQrHRx0UAmUUKh7/WPmQPk X-Google-Smtp-Source: ABdhPJynh06tVgYhVmmJftGtgsjRYvXXVfcgz13GGnh+0ITwPoma2NBlXZqg9rqrnqeCpf0OMzxwYw== X-Received: by 2002:ab0:3886:: with SMTP id z6mr41296049uav.79.1637519892210; Sun, 21 Nov 2021 10:38:12 -0800 (PST) Original-Received: from COMPUTADOR ([2804:14d:90bc:8726:4c9c:5960:c709:1997]) by smtp.googlemail.com with ESMTPSA id q9sm3249092vkn.44.2021.11.21.10.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 10:38:11 -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:220583 Archived-At: >He mean a REALLY long line. Like thousands of characters. >These examples are harmless. Please try to test (1) with a large buffer >that has no newline characters and (2) with 'truncate-lines' non-nil. >'window-text-pixel-size' must be able to handle these cases gracefully >even if it's not geared to them. I think there's a misunderstading. I meant that a facility should be added to `window-text-pixel-size' so that callers like `string-pixel-width' can ask for having no (X) limit without specifying a large number themselves. Basically I want to use: (window-text-pixel-size window (point-min) (point) t) ^^^ (or some other value that `window-text-pixel-size' should understand as meaning "no limit" for X-LIMIT) instead of: (window-text-pixel-size window (point-min) (point) 123456789) The default behavior of the function should stay the same. >Any clients of 'window-text-pixel-size' like 'string-pixel-width' can >easily set X-LIMIT to some sufficiently large value without affecting >the basic functionality of 'window-text-pixel-size'. Yes, that's the simplest solution, but I find passing a random magic number instead of providing a simple interface to say "I don't want to use a limit" (like Y-LIMIT already allows, as I previously mentioned) rather inelegant :) >Please try the attached patch (if it doesn't apply, I'll send you the >affected functions separately so you can apply the changes manually). Can you explain how you are supposed to apply it? I tried: git apply buffer-text-pixel-size.diff But all it says is: error: corrupt patch at line 12 I did apply the changes manually by looking at the .diff file, and it's seemingly working for me. Minus one glaring issue: `string-pixel-width' is using `buffer-size' as the X-LIMIT, but that function returns the amount of characters in the buffer. This means that instead of returning the pixel width, it merely returns the amount of characters in a string. If I change that, everything else seems to be in good order.