[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 86dc3781cd 1/7: transient--insert-group(colum
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 86dc3781cd 1/7: transient--insert-group(columns): Simplify forced single column case |
Date: |
Tue, 2 Jul 2024 18:25:52 -0400 (EDT) |
branch: externals/transient
commit 86dc3781cdb85626c854c2bfd7f9ee238178e17c
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient--insert-group(columns): Simplify forced single column case
---
lisp/transient.el | 77 ++++++++++++++++++++++++++-----------------------------
1 file changed, 37 insertions(+), 40 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index cd1e8db544..a963435e26 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3778,51 +3778,48 @@ have a history of their own.")
(insert " "))
(insert ?\n))
-(cl-defmethod transient--insert-group ((group transient-column))
+(cl-defmethod transient--insert-group ((group transient-column)
+ &optional skip-empty)
(transient--maybe-pad-keys group)
(dolist (suffix (oref group suffixes))
(let ((str (transient-with-shadowed-buffer (transient-format suffix))))
- (insert str)
- (unless (string-match-p ".\n\\'" str)
- (insert ?\n)))))
+ (unless (and (not skip-empty) (equal str ""))
+ (insert str)
+ (unless (string-match-p ".\n\\'" str)
+ (insert ?\n))))))
(cl-defmethod transient--insert-group ((group transient-columns))
- (let* ((columns
- (mapcar
- (lambda (column)
- (transient--maybe-pad-keys column group)
- (transient-with-shadowed-buffer
- (let* ((transient--pending-group column)
- (rows (mapcar #'transient-format (oref column
suffixes))))
- (if-let ((desc (transient-format-description column)))
- (cons desc rows)
- rows))))
- (oref group suffixes)))
- (vp (or (oref transient--prefix variable-pitch)
- transient-align-variable-pitch))
- (rs (apply #'max (mapcar #'length columns)))
- (cs (length columns))
- (cw (mapcar (let ((widths (oref transient--prefix column-widths)))
- (lambda (col)
- (apply
- #'max
- (if-let ((min (pop widths)))
- (if vp (* min (transient--pixel-width " ")) min)
- 0)
- (mapcar (if vp #'transient--pixel-width #'length)
- col))))
- columns))
- (cc (transient--seq-reductions-from
- (apply-partially #'+ (* 2 (if vp (transient--pixel-width " ")
1)))
- cw 0)))
- (if transient-force-single-column
- (dotimes (c cs)
- (dotimes (r rs)
- (when-let ((cell (nth r (nth c columns))))
- (unless (equal cell "")
- (insert cell ?\n))))
- (unless (= c (1- cs))
- (insert ?\n)))
+ (if transient-force-single-column
+ (dolist (group (oref group suffixes))
+ (transient--insert-group group t))
+ (let* ((columns
+ (mapcar
+ (lambda (column)
+ (transient--maybe-pad-keys column group)
+ (transient-with-shadowed-buffer
+ (let* ((transient--pending-group column)
+ (rows (mapcar #'transient-format (oref column
suffixes))))
+ (if-let ((desc (transient-format-description column)))
+ (cons desc rows)
+ rows))))
+ (oref group suffixes)))
+ (vp (or (oref transient--prefix variable-pitch)
+ transient-align-variable-pitch))
+ (rs (apply #'max (mapcar #'length columns)))
+ (cs (length columns))
+ (cw (mapcar (let ((widths (oref transient--prefix column-widths)))
+ (lambda (col)
+ (apply
+ #'max
+ (if-let ((min (pop widths)))
+ (if vp (* min (transient--pixel-width " "))
min)
+ 0)
+ (mapcar (if vp #'transient--pixel-width #'length)
+ col))))
+ columns))
+ (cc (transient--seq-reductions-from
+ (apply-partially #'+ (* 2 (if vp (transient--pixel-width " ")
1)))
+ cw 0)))
(dotimes (r rs)
(dotimes (c cs)
(if vp
- [elpa] externals/transient updated (f2cb28a56c -> 32b7a99bf2), Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 93179253c3 4/7: transient--column-stops: New function, Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 86dc3781cd 1/7: transient--insert-group(columns): Simplify forced single column case,
Jonas Bernoulli <=
- [elpa] externals/transient 9c542109c2 3/7: transient--insert-group(columns): Cosmetics, Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 32b7a99bf2 7/7: transient--align-to: New function, Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 6d6a3fe9fc 6/7: transient--insert-group(columns): Avoid having to use coordinates, Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 152b93e602 5/7: transient--mapn: New function, Jonas Bernoulli, 2024/07/02
- [elpa] externals/transient 6d7fc6e1b9 2/7: transient--insert-group(columns): Combine char and pixel paths, Jonas Bernoulli, 2024/07/02