diff --git a/eldoc-box.el b/eldoc-box.el index a094ef2..ebeb069 100644 --- a/eldoc-box.el +++ b/eldoc-box.el @@ -320,9 +320,13 @@ STR has to be a proper documentation, not empty string, not nil, etc." "Return the side of the selected window. Symbol ‘left’ if the selected window is on the left, ‘right’ if on the right. Return ‘left’ if there is only one window." - (let ((left-window (if tab-bar-mode - (window-at-x-y 5 (+ 5 (tab-bar-height nil t))) - (window-at 0 0)))) + ;; Get the window at point (x, y), where x = 0, y = the y coordinate + ;; of point. If this window is the selected window, the selected + ;; window is on the left, otherwise the selected window is on the + ;; right. + (let* ((y (cdr (posn-x-y (posn-at-point)))) + (top (nth 1 (window-absolute-pixel-edges (selected-window)))) + (left-window (window-at-x-y 0 (+ y top)))) (if (eq left-window (selected-window)) 'left 'right)))