[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 9eb9ae6 08/16: Keep frame alive for performance
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/corfu 9eb9ae6 08/16: Keep frame alive for performance |
Date: |
Wed, 28 Apr 2021 14:20:03 -0400 (EDT) |
branch: externals/corfu
commit 9eb9ae67fddb8b12da49b5b5fbd1d5d1aabb0ada
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Keep frame alive for performance
---
corfu.el | 35 +++++++++++++++++------------------
1 file changed, 17 insertions(+), 18 deletions(-)
diff --git a/corfu.el b/corfu.el
index f76e543..8e329c5 100644
--- a/corfu.el
+++ b/corfu.el
@@ -142,18 +142,15 @@ Set to nil in order to disable confirmation."
(defvar-local corfu--input nil
"Cons of last prompt contents and point or t.")
-(defvar-local corfu--popup-frame nil
- "Popup frame.")
-
-(defvar-local corfu--popup-buffer nil
- "Popup buffer.")
-
(defvar-local corfu--overlay nil
"Current candidate overlay.")
(defvar-local corfu--extra-properties nil
"Extra completion properties.")
+(defvar corfu--frame nil
+ "Popup frame.")
+
(defvar corfu--keep-alive
;; nil is undefined command
"\\`\\(nil\\|completion-at-point\\|corfu-.*\\|scroll-other-window.*\\)\\'"
@@ -166,8 +163,6 @@ Set to nil in order to disable confirmation."
corfu--index
corfu--input
corfu--total
- corfu--popup-frame
- corfu--popup-buffer
corfu--overlay
corfu--extra-properties)
"Buffer-local state variables used by Corfu.")
@@ -198,9 +193,9 @@ Set to nil in order to disable confirmation."
(y (+ (cadr edge) y))
(y (if (> (+ y height (* 3 lh)) (frame-pixel-height))
(- y height)
- (+ y lh))))
- (setq corfu--popup-buffer (or corfu--popup-buffer (generate-new-buffer "
*corfu*")))
- (with-current-buffer corfu--popup-buffer
+ (+ y lh)))
+ (buffer (get-buffer-create " *corfu*")))
+ (with-current-buffer buffer
(setq-local mode-line-format nil
header-line-format nil
frame-title-format ""
@@ -217,8 +212,11 @@ Set to nil in order to disable confirmation."
(let (inhibit-modification-hooks)
(erase-buffer)
(insert content)))
- (unless corfu--popup-frame
- (setq corfu--popup-frame
+ (unless (and (frame-live-p corfu--frame)
+ (eq (frame-parent corfu--frame) (window-frame)))
+ (when corfu--frame
+ (delete-frame corfu--frame))
+ (setq corfu--frame
(make-frame
`((parent-frame . ,(window-frame))
(background-color . ,(face-attribute 'corfu-background
:background))
@@ -242,10 +240,12 @@ Set to nil in order to disable confirmation."
(undecorated . t)
(cursor-type . nil)
(minibuffer . nil)
+ (visibility . nil)
(no-special-glyphs . t))))
- (set-window-buffer (frame-root-window corfu--popup-frame)
corfu--popup-buffer))
- (set-frame-position corfu--popup-frame x y)
- (set-frame-size corfu--popup-frame width height t)))
+ (set-window-buffer (frame-root-window corfu--frame) buffer))
+ (set-frame-position corfu--frame x y)
+ (set-frame-size corfu--frame width height t)
+ (make-frame-visible corfu--frame)))
(defun corfu--popup (pos lines &optional curr lo bar)
"Show LINES as popup at POS, with CURR highlighted and scrollbar from LO to
LO+BAR."
@@ -654,8 +654,7 @@ Set to nil in order to disable confirmation."
(remove-hook 'pre-command-hook #'corfu--pre-command-hook 'local)
(remove-hook 'post-command-hook #'corfu--post-command-hook 'local)
(when corfu--overlay (delete-overlay corfu--overlay))
- (when corfu--popup-frame (delete-frame corfu--popup-frame))
- (when corfu--popup-buffer (kill-buffer corfu--popup-buffer))
+ (when (frame-live-p corfu--frame) (make-frame-invisible corfu--frame))
(mapc #'kill-local-variable corfu--state-vars))
(defun corfu--mode-hook ()
- [elpa] externals/corfu updated (5d59adc -> a53a98a), Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu fef8377 02/16: Add popup comment (See #10 and #15), Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 5951abd 04/16: Reorder exit conditions, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 7155196 05/16: Simplify, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 59a3037 06/16: Ensure that overlay is deleted properly, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 9eb9ae6 08/16: Keep frame alive for performance,
Protesilaos Stavrou <=
- [elpa] externals/corfu e5dad66 09/16: Use internal border, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu e4d66b6 10/16: Use spaces for border/bar instead of image, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu cdd215d 13/16: Ensure that frame buffer is set, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu a53a98a 16/16: Simplify face definitions, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 59949d3 03/16: Use child frames instead of overlays, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 9aa922d 01/16: Use `vertical-motion` instead of `forward-line`, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 4f6aac9 07/16: Ensure that documentation/location frame still works with child-frame popup, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu aab3bb5 11/16: Use redraw-frame, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 3cfb6f4 12/16: Pixel-perfect positioning, Protesilaos Stavrou, 2021/04/28
- [elpa] externals/corfu 2ef1beb 14/16: Use italic face for "No match" message, Protesilaos Stavrou, 2021/04/28