Workaround childframe sizing issue (issue#68)

* eldoc-box.el (eldoc-box--update-childframe-geometry): Set frame size
to something very small before calculating the text size.
This commit is contained in:
Yuan Fu 2023-04-27 00:58:17 -07:00
parent 90deae21cc
commit 4066df5a29
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -376,6 +376,17 @@ base on WIDTH and HEIGHT of childframe text window."
(defun eldoc-box--update-childframe-geometry (frame window) (defun eldoc-box--update-childframe-geometry (frame window)
"Update the size and the position of childframe. "Update the size and the position of childframe.
FRAME is the childframe, WINDOW is the primary window." FRAME is the childframe, WINDOW is the primary window."
;; WORKAROUND: See issue#68. If theres some text with a display
;; property of (space :width text) -- which is what we apply onto
;; markdown separators -- window-text-pixel-size wouldnt return
;; the correct value. Instead, it returns the current window width.
;; So now the childram only grows in size and never shrinks. For
;; whatever reason, if we set the frame size very small before
;; calculating windows text size, it can return the right value.
;; (My guess is that the function takes (space :width text) at face
;; value, but that cant be the whole picture because it works fine
;; when I manually evaluate the function in the childframe...)
(set-frame-size frame 1 1 t)
(let* ((size (let* ((size
(window-text-pixel-size (window-text-pixel-size
window nil nil window nil nil