all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thuna <thuna.cing@gmail.com>
To: 53498@debbugs.gnu.org
Subject: bug#53498: [PATCH] Fix tabulated-list-widen-current-column not working for non-strings
Date: Mon, 24 Jan 2022 13:55:26 +0300	[thread overview]
Message-ID: <87bl01z9lt.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-tabulated-list-widen-current-column-not-working-.patch --]
[-- Type: text/x-diff, Size: 1757 bytes --]

From c5d6b80867f7f02b8ecbc5ed7dc8009c570831ac Mon Sep 17 00:00:00 2001
From: Thuna <thuna.cing@gmail.com>
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


             reply	other threads:[~2022-01-24 10:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 10:55 Thuna [this message]
2022-01-24 14:32 ` bug#53498: [PATCH] Fix tabulated-list-widen-current-column not working for non-strings Lars Ingebrigtsen
2022-01-24 15:14   ` Thuna
2022-01-24 17:31     ` Lars Ingebrigtsen
2022-01-24 17:43       ` Thuna
2022-01-25 11:59         ` Lars Ingebrigtsen
2022-01-25 12:16           ` Thuna

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

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

  git send-email \
    --in-reply-to=87bl01z9lt.fsf@gmail.com \
    --to=thuna.cing@gmail.com \
    --cc=53498@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.