From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thuna Newsgroups: gmane.emacs.bugs Subject: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not working for non-strings Date: Mon, 24 Jan 2022 13:55:26 +0300 Message-ID: <87bl01z9lt.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35818"; mail-complaints-to="usenet@ciao.gmane.io" To: 53498@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 24 12:05:41 2022 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 1nBxAK-0009BK-SP for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Jan 2022 12:05:40 +0100 Original-Received: from localhost ([::1]:56478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBxAJ-00016X-S8 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 24 Jan 2022 06:05:39 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBx9i-00016G-Ud for bug-gnu-emacs@gnu.org; Mon, 24 Jan 2022 06:05:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49448) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBx9i-0005yI-KJ for bug-gnu-emacs@gnu.org; Mon, 24 Jan 2022 06:05:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nBx9i-0007wB-G3 for bug-gnu-emacs@gnu.org; Mon, 24 Jan 2022 06:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thuna Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Jan 2022 11:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53498 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164302224530437 (code B ref -1); Mon, 24 Jan 2022 11:05:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Jan 2022 11:04:05 +0000 Original-Received: from localhost ([127.0.0.1]:42351 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBx8n-0007ur-7m for submit@debbugs.gnu.org; Mon, 24 Jan 2022 06:04:05 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:58370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBx8k-0007uh-L4 for submit@debbugs.gnu.org; Mon, 24 Jan 2022 06:04:04 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBx8k-0000u6-EY for bug-gnu-emacs@gnu.org; Mon, 24 Jan 2022 06:04:02 -0500 Original-Received: from [2a00:1450:4864:20::130] (port=47040 helo=mail-lf1-x130.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBx8j-0005rx-0H for bug-gnu-emacs@gnu.org; Mon, 24 Jan 2022 06:04:02 -0500 Original-Received: by mail-lf1-x130.google.com with SMTP id z19so11718864lfq.13 for ; Mon, 24 Jan 2022 03:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=6WoUA9O1o5bl1b/UeMOMyzI/v1E+39Ugovyqlc3kPRc=; b=BnprKqH59DuJo+VvJAD9m7cEPS7wxXp7PUIqN8rWpwUihAyfCThAuc143QKC0ffEgG 8E+esfVfyN9DGdx079romDlmFcoH0V8bwA3QwkvK3gZoVWz1s4Cre1xPz3e0QgmrMjK+ TR2L0l3FGBqaLQi7yC+utdE8aj+uHecEFmJSfmh4aN608egT33VrmGLdz91zMrdBxyat htRUDttEBlKCHMrPdLpnM2lKsg/zDhS6/AkHB2ABhkjrWAIIzc3OXB2miM/uDHQW0rIs GS/kXG6nVM8ogtmt9oBN97dUB9A/iZoreacBGYZB6hV+HzQb4ob6WatCazO5qCEZDwTd /Ihg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=6WoUA9O1o5bl1b/UeMOMyzI/v1E+39Ugovyqlc3kPRc=; b=eT8Z1wfJ+nyQa1qyDIO1+cLvtTp7mLyGXL4ixBHMEUScN2frbXsAo2U2ZCUS1hkQIV Q7KMuFf2ReIU/29ThZQHvSlXXydStB5P3C2TMZ+lW2aPewKY6m0royAJ9p7JUC3vFNAb CHkcHJhSIupaZb+LFNCcpK4JltW1ozdBpmEiRpENxeSQgwBJWr0Ln37K0+b/5rkoLdQa HH1MBzIgQ6TCTIHVQBfXr7jUYnsLzI5OJwbNtTXSgb1ipUXY/pgssBK/w8YBE7WW8XLW r5J38XVH8hyTtU40Rkj/UwB5gNi3+4eN2sw5ZBETFV9Mg4NEfNMQsEQcje5OP1Fn2X0B TxEg== X-Gm-Message-State: AOAM530DnRFs1iCdkdYOLjJb1UYDf1vfGyyOVOlR0veOvjZeb+viDtnO /DRssqtwM5VMoo4C+qwibAOIZ43U5Pg= X-Google-Smtp-Source: ABdhPJy4JMAmBrz09t0g+8SEMsg+nxvhV4rVIkY4aPG+0fZ6aFeN3HfanKg7gV8i3/VqTl/b2sooJg== X-Received: by 2002:a17:906:2797:: with SMTP id j23mr11574257ejc.223.1643021728760; Mon, 24 Jan 2022 02:55:28 -0800 (PST) Original-Received: from Thuna ([78.161.73.233]) by smtp.gmail.com with ESMTPSA id p16sm4759795eja.19.2022.01.24.02.55.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 02:55:28 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::130 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=thuna.cing@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:225026 Archived-At: --=-=-= Content-Type: text/plain Previously tabulted-list-widen-current-column failed to work when point was at or ahead of a button or an image. It now checks for image width and button width. Button width calculation doesn't account for the properties of the button, however, so that is left there as a FIXME. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Fix-tabulated-list-widen-current-column-not-working-.patch >From c5d6b80867f7f02b8ecbc5ed7dc8009c570831ac Mon Sep 17 00:00:00 2001 From: Thuna Date: Mon, 24 Jan 2022 12:40:13 +0300 Subject: [PATCH] Fix tabulated-list-widen-current-column not working for non-strings * tabulated-list.el (tabulated-list-widen-current-column): Consider buttons and images when calculating the width of the contents of a cell. --- lisp/emacs-lisp/tabulated-list.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el index 7ad4f7f863..2ace7ebb35 100644 --- a/lisp/emacs-lisp/tabulated-list.el +++ b/lisp/emacs-lisp/tabulated-list.el @@ -734,7 +734,16 @@ tabulated-list-widen-current-column (max (setq col-width (cadr (aref tabulated-list-format col-nb))) - (string-width (aref entry col-nb))) + (let ((desc (aref entry col-nb))) + (cond + ((stringp desc) + (string-width desc)) + ((eq (car desc) 'image) + (car (image-size desc))) + (t (string-width (car desc)) + ;; FIXME: Take into consideration the properties + ;; of the button when calculating width + )))) (or (plist-get (nthcdr 3 (aref tabulated-list-format col-nb)) :pad-right) -- 2.25.1 --=-=-=--