Fix: tool-bar-mode mess up popup position

This commit is contained in:
Yuan Fu 2018-12-21 02:16:02 -05:00
parent 108403d5f3
commit 291e5ac97c
No known key found for this signature in database
GPG Key ID: 1CF5ECABEC37A901

View File

@ -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 (x (- (car point-pos) (car frame-pos))) ; relative to native frame
(y (- (cdr point-pos) (nth 1 frame-pos))) (y (- (cdr point-pos) (nth 1 frame-pos)))
(en (frame-char-width)) (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) (cons (if (< (- (frame-inner-width) width) x)
;; space on the right of the pos is not enough ;; space on the right of the pos is not enough
;; put to left ;; put to left
(- x width) (max 0 (- x width))
(+ x en)) (+ x en))
(if (< (- (frame-inner-height) height) y) (if (< (- (frame-inner-height) height) y)
;; space under the pos is not enough ;; space under the pos is not enough
;; put above ;; put above
(- y height) (max 0 (- y height))
(+ y em))))) (+ y em tool-bar)))))
(defun eldoc-box--get-frame (buffer) (defun eldoc-box--get-frame (buffer)
"Return a childframe displaying BUFFER. "Return a childframe displaying BUFFER.