emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/vertico-posframe 8abb1d7 2/3: Improve minibuffer cover


From: ELPA Syncer
Subject: [elpa] externals/vertico-posframe 8abb1d7 2/3: Improve minibuffer cover feature.
Date: Thu, 28 Oct 2021 22:57:39 -0400 (EDT)

branch: externals/vertico-posframe
commit 8abb1d76e31a6077166f8381af452a449ffa634a
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Improve minibuffer cover feature.
    
        * vertico-posframe.el
        (vertico-posframe--create-minibuffer-cover)
        (vertico-posframe--show-minibuffer-p): New functions.
        (vertico-posframe--display)
        (vertico-posframe-post-command-function): Use new functions.
---
 vertico-posframe.el | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/vertico-posframe.el b/vertico-posframe.el
index cf673e2..0235324 100644
--- a/vertico-posframe.el
+++ b/vertico-posframe.el
@@ -171,7 +171,7 @@ Optional argument FRAME ."
   (let ((count (vertico--format-count))
         (prompt (minibuffer-prompt))
         (content (minibuffer-contents))
-        (input-method current-input-method))
+        (show-minibuffer (vertico-posframe--show-minibuffer-p)))
     (with-current-buffer (get-buffer-create vertico-posframe--buffer)
       (setq-local inhibit-modification-hooks t
                   cursor-in-non-selected-windows 'box)
@@ -182,15 +182,9 @@ Optional argument FRAME ."
               "\n" (string-join lines)))
     (with-selected-window (vertico-posframe-last-window)
       ;; Create a posframe to cover minibuffer.
-      (if input-method
+      (if show-minibuffer
           (posframe-hide vertico-posframe--minibuffer-cover)
-        (let* ((win (active-minibuffer-window))
-               (x (window-pixel-left win))
-               (y (window-pixel-top win)))
-          (posframe-show vertico-posframe--minibuffer-cover
-                         :string (make-string 120 ? )
-                         :position (cons x y)
-                         :lines-truncate t)))
+        (vertico-posframe--create-minibuffer-cover))
       (vertico-posframe--show))))
 
 (defun vertico-posframe--show (&optional string)
@@ -211,6 +205,21 @@ Show STRING when it is a string."
          :lines-truncate t
          (funcall vertico-posframe-size-function)))
 
+(defun vertico-posframe--create-minibuffer-cover ()
+  "Create minibuffer cover."
+  (let* ((win (active-minibuffer-window))
+         (x (window-pixel-left win))
+         (y (window-pixel-top win)))
+    (posframe-show vertico-posframe--minibuffer-cover
+                   :string (make-string 120 ? )
+                   :position (cons x y)
+                   :lines-truncate t)))
+
+(defun vertico-posframe--show-minibuffer-p ()
+  "Test show minibuffer or not."
+  (or current-input-method
+      (string-match-p "^eval-*" (symbol-name this-command))))
+
 (defun vertico-posframe-last-window ()
   "Get the last actived window before active minibuffer."
   (let ((window vertico-posframe--last-window))
@@ -240,8 +249,6 @@ Show STRING when it is a string."
     (when (and vertico-posframe-mode
                (minibufferp)
                (posframe-workable-p))
-      (when (string-match-p "^eval-*" (symbol-name this-command))
-        (posframe-hide vertico-posframe--minibuffer-cover))
       (with-current-buffer (window-buffer (active-minibuffer-window))
         (let* ((count (vertico--format-count))
                (count-length (length count))



reply via email to

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