                                 (format "%S: %s" ',name bdoc))))
                 (when (and defdoc
                            ',wrapped (not (plist-get ',binding :exit)))
-                  (setq max-mini-window-height (1+ (how-many-str "\n" defdoc)))
+                  (spacemacs//micro-state-set-minibuffer-height defdoc)
                   (apply ',msg-func
                          (list (spacemacs//micro-state-propertize-doc
                                 (format "%S: %s" ',name defdoc)))))))))

              ,@on-enter
              (let ((doc ,@doc))
                (when doc
                  (setq max-mini-window-height (1+ (how-many-str "\n" doc)))
                  (apply ',msg-func (list (spacemacs//micro-state-propertize-doc
                                           (format "%S: %s" ',name doc))))))
              ,(when exec-binding

                        :bold t)))
(spacemacs/defface-micro-state-faces)

(defun spacemacs//micro-state-set-minibuffer-height (str)
  "Set the max mini windows size given a string STR."
  (let ((line-count (1+ (how-many-str "\n" str))))
    (when (and (> line-count max-mini-window-height)
               (> line-count 10))
      (setq max-mini-window-height line-count))))

(defmacro spacemacs|define-micro-state (name &rest props)
  "Define a micro-state called NAME.

