From e58ecc46996a9c0271e2c3e68c921b6c7cb10026 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Fri, 26 May 2023 14:00:01 -0700 Subject: [PATCH] Improve eldoc-box--window-side * eldoc-box.el (eldoc-box--window-side): Now it consistently returns 'left' even if the left side is split vertically. --- eldoc-box.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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)))