Skip to content

Commit

Permalink
[maybe] transient--column-max-width: New function
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Nov 20, 2023
1 parent 30b6e47 commit 957af46
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -3584,16 +3584,8 @@ have a history of their own.")
(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 ((rows (mapcar #'transient-format (oref column suffixes))))
(when-let ((desc (transient-format-description column)))
(push desc rows))
(flatten-tree rows))))
(oref group suffixes)))
(let* ((columns (mapcar #'transient--column-max-width
(oref group suffixes)))
(vp (or (oref transient--prefix variable-pitch)
transient-align-variable-pitch))
(rs (apply #'max (mapcar #'length columns)))
Expand Down Expand Up @@ -3632,6 +3624,14 @@ have a history of their own.")
(when (= c (1- cs))
(insert ?\n))))))))

(defun transient--column-max-width (column &optional parent)
(transient--maybe-pad-keys column group)
(transient-with-shadowed-buffer
(let ((rows (mapcar #'transient-format (oref column suffixes))))
(when-let ((desc (transient-format-description column)))
(push desc rows))
(flatten-tree rows))))

(cl-defmethod transient--insert-group ((group transient-subgroups))
(let* ((subgroups (oref group suffixes))
(n (length subgroups)))
Expand Down

0 comments on commit 957af46

Please sign in to comment.