Last active
January 29, 2021 18:19
-
-
Save nxtr/a606d4b15dcb2adec3dcb26969b97ab8 to your computer and use it in GitHub Desktop.
A dynamic and adaptive function used by `ivy-posframe-size-function'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ivy-posframe-size-function | |
(lambda () | |
(list | |
:height (or ivy-posframe-height ivy-height) | |
:width ivy-posframe-width | |
:min-height (or ivy-posframe-min-height ivy-height) | |
:min-width (or ivy-posframe-min-width | |
(let* ((buf-rows (split-string | |
(with-current-buffer ivy-posframe-buffer | |
(buffer-string)) | |
"\n")) | |
(prompt (split-string | |
(with-temp-buffer | |
(ivy--insert-prompt) | |
(buffer-string)) | |
"\n")) | |
(max-prompt-col (seq-max (seq-map #'length prompt)))) | |
(max (seq-max (seq-map #'length buf-rows)) | |
(+ max-prompt-col (length ivy-text) 2))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment