Function: which-key--create-pages-1

which-key--create-pages-1 is a byte-compiled function defined in which-key.el.gz.

Signature

(which-key--create-pages-1 KEYS AVAILABLE-LINES AVAILABLE-WIDTH &optional MIN-LINES VERTICAL)

Documentation

Create page strings using which-key--list-to-pages.

Will try to find the best number of rows and columns using the given dimensions and the length and widths of ITEMS. Use VERTICAL if the ITEMS are laid out vertically and the number of columns should be minimized.

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--create-pages-1
    (keys available-lines available-width &optional min-lines vertical)
  "Create page strings using `which-key--list-to-pages'.
Will try to find the best number of rows and columns using the
given dimensions and the length and widths of ITEMS.  Use VERTICAL
if the ITEMS are laid out vertically and the number of columns
should be minimized."
  (let ((result (which-key--list-to-pages
                 keys available-lines available-width))
        (min-lines (or min-lines 0))
        found prev-result)
    (if (or (null result)
            vertical
            (> (which-key--pages-num-pages result) 1)
            (= 1 available-lines))
        result
      ;; simple search for a fitting page
      (while (and (> available-lines min-lines)
                  (not found))
        (setq available-lines (cl-decf available-lines)
              prev-result result
              result (which-key--list-to-pages
                      keys available-lines available-width)
              found (> (which-key--pages-num-pages result) 1)))
      (if found prev-result result))))