branch: elpa/eldoc-mouse
commit da9e8e0ebc1dc3eb240b32e75ea451ce86b45f27
Author: huangfeiyu <[email protected]>
Commit: GitHub <[email protected]>

    fix the issue that sometimes the mouse can not be moved to the popup.
---
 eldoc-mouse.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/eldoc-mouse.el b/eldoc-mouse.el
index 376184479f1..bb4b2895e3f 100644
--- a/eldoc-mouse.el
+++ b/eldoc-mouse.el
@@ -191,7 +191,8 @@ A leading space make the buffer hidden."
 (defun eldoc-mouse--post-command-hook ()
   "The hook of post-command used by eldoc-mouse.
 Support close the popup when the cursor is moved away."
-  (when (not (eq 'eldoc-mouse-doc-on-mouse this-command))
+  (when (and (not (eq 'eldoc-mouse-doc-on-mouse this-command))
+             (not (eldoc-mouse-is-mouse-hovering-posframe)))
     (let ((pos (point)))
       (when (or (< pos (car eldoc-mouse-last-symbol-bounds))
                 (> pos (cdr eldoc-mouse-last-symbol-bounds)))
@@ -206,9 +207,7 @@ Support close the popup when user switch buffer."
   "Ask eldoc to show documentation for symbol at POS.
 POS is the buffer position under the mouse cursor."
   (when (and (number-or-marker-p pos)
-             (not
-              (eldoc-mouse-is-mouse-hovering-posframe?
-               eldoc-mouse-posframe-buffer-name))
+             (not (eldoc-mouse-is-mouse-hovering-posframe))
              (or (null eldoc-mouse-last-symbol-bounds)
                  (< pos (car eldoc-mouse-last-symbol-bounds))
                  (> pos (cdr eldoc-mouse-last-symbol-bounds))))
@@ -307,9 +306,9 @@ So it won't call `eglot--highlight-piggyback` with `CB`."
                             fun))
             fun-list2)))
 
-(defun eldoc-mouse-is-mouse-hovering-posframe? (posframe-name)
+(defun eldoc-mouse-is-mouse-hovering-posframe ()
   "Check if the mouse is hovering over the given posframe `POSFRAME-NAME'."
-  (let* ((posframe (get-buffer posframe-name)) ;; Get the posframe buffer
+  (let* ((posframe (get-buffer eldoc-mouse-posframe-buffer-name)) ;; Get the 
posframe buffer
          (frame (get-buffer-window posframe)))
     ;; keep the child frame when it is clicked, need a better
     ;; way to determine if the mouse is over the child frame.

Reply via email to