Use `window-width' to wrap menu items.

This commit is contained in:
Phil Jackson 2010-09-01 23:43:57 +01:00
parent 2e00a113d9
commit 564726a247

View file

@ -379,13 +379,12 @@ put it in magit-key-mode-key-maps for fast lookup."
(defun magit-key-mode-draw-in-cols (strings) (defun magit-key-mode-draw-in-cols (strings)
"Given a list of strings, print in columns (using `insert')." "Given a list of strings, print in columns (using `insert')."
(let ((longest-act (apply 'max (mapcar 'length strings))) (let ((longest-act (apply 'max (mapcar 'length strings))))
(max-size 70))
(while strings (while strings
(let ((str (car strings))) (let ((str (car strings)))
(let ((padding (make-string (- (+ longest-act 3) (length str)) ? ))) (let ((padding (make-string (- (+ longest-act 3) (length str)) ? )))
(insert str) (insert str)
(if (and (> (+ (current-column) longest-act) max-size) (if (and (> (+ (current-column) longest-act) (window-width))
(cdr strings)) (cdr strings))
(insert "\n") (insert "\n")
(insert padding)))) (insert padding))))