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 2, 2023
1 parent 75bd503 commit cd8dc95
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions lisp/transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -3570,15 +3570,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)
(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 @@ -3617,6 +3610,13 @@ 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)
(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 cd8dc95

Please sign in to comment.