[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu 44d49d5 2/3: Close popup on click

From: ELPA Syncer
Subject: [elpa] externals/corfu 44d49d5 2/3: Close popup on click
Date: Sun, 11 Jul 2021 02:57:07 -0400 (EDT)

branch: externals/corfu
commit 44d49d5ccc376f5a8c7280f76cd7a4eff0fa54a0
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Close popup on click
 corfu.el | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/corfu.el b/corfu.el
index 15f279c..2bf47af 100644
--- a/corfu.el
+++ b/corfu.el
@@ -243,11 +243,19 @@ filter string with spaces is allowed."
     (buffer-read-only . t))
   "Default child frame buffer parameters.")
+(defun corfu--popup-hide-on-click ()
+  "Close if mouse events land in the popup."
+  (when (mouse-event-p last-input-event)
+    (select-frame (frame-parent corfu--frame) 'norecord)
+    (corfu--popup-hide)
+    (setq this-command #'ignore)))
 (defun corfu--make-buffer (content)
   "Create corfu buffer with CONTENT."
   (let ((fr face-remapping-alist)
         (buffer (get-buffer-create " *corfu*")))
     (with-current-buffer buffer
+      (add-hook 'pre-command-hook #'corfu--popup-hide-on-click nil 'local)
       (dolist (var corfu--buffer-parameters)
         (set (make-local-variable (car var)) (cdr var)))
       (setq-local face-remapping-alist fr)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]