Function: which-key--total-width-to-text

which-key--total-width-to-text is a byte-compiled function defined in which-key.el.gz.

Signature

(which-key--total-width-to-text TOTAL-WIDTH)

Documentation

Convert window TOTAL-WIDTH to window text-width.

TOTAL-WIDTH is the desired total width of the window. The function calculates what text width fits such a window. The calculation considers possible fringes and scroll bars. This function assumes that the desired window has the same character width as the frame.

Source Code

;; Defined in /usr/src/emacs/lisp/which-key.el.gz
(defun which-key--total-width-to-text (total-width)
  "Convert window TOTAL-WIDTH to window text-width.
TOTAL-WIDTH is the desired total width of the window.  The function calculates
what text width fits such a window.  The calculation considers possible fringes
and scroll bars.  This function assumes that the desired window has the same
character width as the frame."
  (let ((char-width (frame-char-width)))
    (- total-width
       (/ (frame-fringe-width) char-width)
       (/ (frame-scroll-bar-width) char-width)
       (if (which-key--char-enlarged-p) 1 0)
       ;; add padding to account for possible wide (unicode) characters
       3)))