mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-01 19:30:45 -08:00
Don't show page if first column doesn't fit
This commit is contained in:
parent
82ea3f8789
commit
765136acaf
1 changed files with 23 additions and 20 deletions
43
which-key.el
43
which-key.el
|
|
@ -844,26 +844,29 @@ element in each list element of KEYS."
|
|||
(-partition-all avl-lines keys)))
|
||||
(page-width 0) (n-pages 0)
|
||||
page-cols pages keys/page page-widths)
|
||||
(dolist (col cols-w-widths)
|
||||
(if (<= (+ (car col) page-width) avl-width)
|
||||
(progn (push (cdr col) page-cols)
|
||||
(setq page-width (+ page-width (car col))))
|
||||
(when (> (length page-cols) 0)
|
||||
(push (which-key--join-columns page-cols) pages)
|
||||
(push (* (length page-cols) avl-lines) keys/page)
|
||||
(push page-width page-widths)
|
||||
(setq n-pages (1+ n-pages)
|
||||
page-cols (list (cdr col))
|
||||
page-width (car col)))))
|
||||
(when (> (length page-cols) 0)
|
||||
(push (which-key--join-columns page-cols) pages)
|
||||
(push (* (length page-cols) avl-lines) keys/page)
|
||||
(push page-width page-widths)
|
||||
(setq n-pages (1+ n-pages)))
|
||||
(list :pages (reverse pages) :page-height avl-lines
|
||||
:page-widths (reverse page-widths)
|
||||
:keys/page (reverse keys/page) :n-pages n-pages
|
||||
:tot-keys (cl-reduce '+ keys/page :initial-value 0))))
|
||||
(if (> (car (car cols-w-widths)) avl-width)
|
||||
(list :pages nil :page-height 0 :page-widths '(0)
|
||||
:keys/page '(0) :n-pages 0 :tot-keys 0)
|
||||
(dolist (col cols-w-widths)
|
||||
(if (<= (+ (car col) page-width) avl-width)
|
||||
(progn (push (cdr col) page-cols)
|
||||
(setq page-width (+ page-width (car col))))
|
||||
(when (> (length page-cols) 0)
|
||||
(push (which-key--join-columns page-cols) pages)
|
||||
(push (* (length page-cols) avl-lines) keys/page)
|
||||
(push page-width page-widths)
|
||||
(setq n-pages (1+ n-pages)
|
||||
page-cols (list (cdr col))
|
||||
page-width (car col)))))
|
||||
(when (> (length page-cols) 0)
|
||||
(push (which-key--join-columns page-cols) pages)
|
||||
(push (* (length page-cols) avl-lines) keys/page)
|
||||
(push page-width page-widths)
|
||||
(setq n-pages (1+ n-pages)))
|
||||
(list :pages (reverse pages) :page-height avl-lines
|
||||
:page-widths (reverse page-widths)
|
||||
:keys/page (reverse keys/page) :n-pages n-pages
|
||||
:tot-keys (cl-reduce '+ keys/page :initial-value 0)))))
|
||||
|
||||
(defun which-key--create-pages (prefix-keys keys sel-win-width)
|
||||
(let* ((max-dims (which-key--popup-max-dimensions sel-win-width))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue