[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vertico-posframe c5fefb0 1/2: Add vertico-posframe--for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vertico-posframe c5fefb0 1/2: Add vertico-posframe--format-count and use it. |
Date: |
Fri, 29 Oct 2021 01:57:35 -0400 (EDT) |
branch: externals/vertico-posframe
commit c5fefb0e3f9cc97c89845ceaac8820a13e2bbd8d
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Add vertico-posframe--format-count and use it.
* vertico-posframe.el (vertico-posframe--format-count): New function.
(vertico-posframe--display)
(vertico-posframe-post-command-function)
(vertico-posframe--minibuffer-message): Use
vertico-posframe--format-count.
---
vertico-posframe.el | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/vertico-posframe.el b/vertico-posframe.el
index c671171..988bccb 100644
--- a/vertico-posframe.el
+++ b/vertico-posframe.el
@@ -168,7 +168,7 @@ Optional argument FRAME ."
(defun vertico-posframe--display (lines)
"Display LINES in posframe."
- (let ((count (vertico--format-count))
+ (let ((count (vertico-posframe--format-count))
(prompt (minibuffer-prompt))
(content (minibuffer-contents))
(show-minibuffer (vertico-posframe--show-minibuffer-p)))
@@ -176,8 +176,7 @@ Optional argument FRAME ."
(setq-local inhibit-modification-hooks t
cursor-in-non-selected-windows 'box)
(erase-buffer)
- (insert (propertize (concat count prompt) 'face 'minibuffer-prompt)
- content
+ (insert count prompt content
(propertize " " 'face 'vertico-posframe-cursor)
"\n" (string-join lines)))
(with-selected-window (vertico-posframe-last-window)
@@ -187,6 +186,10 @@ Optional argument FRAME ."
(vertico-posframe--create-minibuffer-cover))
(vertico-posframe--show))))
+(defun vertico-posframe--format-count ()
+ "Format vertico count."
+ (propertize (or (vertico--format-count) "") 'face 'minibuffer-prompt))
+
(defun vertico-posframe--show (&optional string)
"`posframe-show' of vertico-posframe.
Show STRING when it is a string."
@@ -250,7 +253,7 @@ Show STRING when it is a string."
(minibufferp)
(posframe-workable-p))
(with-current-buffer (window-buffer (active-minibuffer-window))
- (let* ((count (vertico--format-count))
+ (let* ((count (vertico-posframe--format-count))
(count-length (length count))
(point (point))
(prompt (buffer-string)))
@@ -258,7 +261,7 @@ Show STRING when it is a string."
(with-current-buffer (get-buffer-create vertico-posframe--buffer)
(goto-char (point-min))
(delete-region (point) (line-beginning-position 2))
- (insert (propertize (concat count prompt) 'face
'minibuffer-prompt) " \n")
+ (insert count prompt " \n")
(add-text-properties
(+ point count-length) (+ point count-length 1)
'(face vertico-posframe-cursor))))))))
@@ -276,10 +279,9 @@ Show STRING when it is a string."
(defun vertico-posframe--minibuffer-message (message &rest _args)
"Advice function of `minibuffer-message'.
Argument MESSAGE ."
- (let* ((count (vertico--format-count))
+ (let* ((count (vertico-posframe--format-count))
(prompt (buffer-string)))
- (vertico-posframe--show
- (concat (propertize (concat count prompt) 'face 'minibuffer-prompt)
message))))
+ (vertico-posframe--show (concat count prompt message))))
;;;###autoload
(define-minor-mode vertico-posframe-mode