From 291e5ac97c1fc6eba606d33f8bd317d35edbe447 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Fri, 21 Dec 2018 02:16:02 -0500 Subject: [PATCH] Fix: tool-bar-mode mess up popup position --- eldoc-box.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eldoc-box.el b/eldoc-box.el index d66a61a..d41bf5e 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -204,17 +204,22 @@ Position is calculated base on WIDTH and HEIGHT of chilframe text window" (x (- (car point-pos) (car frame-pos))) ; relative to native frame (y (- (cdr point-pos) (nth 1 frame-pos))) (en (frame-char-width)) - (em (frame-char-height))) + (em (frame-char-height)) + (frame-geometry (frame-geometry)) + (tool-bar (if (and tool-bar-mode + (alist-get 'tool-bar-external frame-geometry)) + (cdr (alist-get 'tool-bar-size frame-geometry)) + 0))) (cons (if (< (- (frame-inner-width) width) x) ;; space on the right of the pos is not enough ;; put to left - (- x width) + (max 0 (- x width)) (+ x en)) (if (< (- (frame-inner-height) height) y) ;; space under the pos is not enough ;; put above - (- y height) - (+ y em))))) + (max 0 (- y height)) + (+ y em tool-bar))))) (defun eldoc-box--get-frame (buffer) "Return a childframe displaying BUFFER.