branch: externals/corfu commit 7155196f2065a8bd474ba6551d150c19cf4063e4 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Simplify --- corfu.el | 62 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/corfu.el b/corfu.el index 8fd4514..a15f21c 100644 --- a/corfu.el +++ b/corfu.el @@ -192,13 +192,11 @@ Set to nil in order to disable confirmation." (let* ((window-min-height 1) (window-min-width 1) (after-make-frame-functions) - (frame-resize-pixelwise t) - (window-resize-pixelwise t) (edge (window-inside-pixel-edges)) (lh (line-pixel-height)) (x (max 0 (min (+ (car edge) x) (- (frame-pixel-width) width)))) (y (+ (cadr edge) y)) - (y (if (> (+ y lh height) (frame-pixel-height)) + (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*"))) @@ -219,37 +217,35 @@ Set to nil in order to disable confirmation." (let (inhibit-modification-hooks) (erase-buffer) (insert content))) - (setq corfu--popup-frame - (or corfu--popup-frame - (make-frame - `((parent-frame . ,(window-frame)) - (background-color . ,(face-attribute 'corfu-background :background)) - (no-accept-focus . t) - (min-width . t) - (min-height . t) - (width . 0) - (height . 0) - (line-spacing . 0) - (border-width . 0) - (internal-border-width . 0) - (left-fringe . 0) - (right-fringe . 0) - (vertical-scroll-bars . nil) - (horizontal-scroll-bars . nil) - (menu-bar-lines . 0) - (tool-bar-lines . 0) - (tab-bar-lines . 0) - (no-other-frame . t) - (unsplittable . t) - (undecorated . t) - (visibility . nil) - (cursor-type . nil) - (minibuffer . nil) - (no-special-glyphs . t))))) - (set-window-buffer (frame-root-window corfu--popup-frame) corfu--popup-buffer) - (set-frame-size corfu--popup-frame width height t) + (unless corfu--popup-frame + (setq corfu--popup-frame + (make-frame + `((parent-frame . ,(window-frame)) + (background-color . ,(face-attribute 'corfu-background :background)) + (no-accept-focus . t) + (min-width . t) + (min-height . t) + (width . 0) + (height . 0) + (line-spacing . 0) + (border-width . 0) + (internal-border-width . 0) + (left-fringe . 0) + (right-fringe . 0) + (vertical-scroll-bars . nil) + (horizontal-scroll-bars . nil) + (menu-bar-lines . 0) + (tool-bar-lines . 0) + (tab-bar-lines . 0) + (no-other-frame . t) + (unsplittable . t) + (undecorated . t) + (cursor-type . nil) + (minibuffer . 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) - (make-frame-visible corfu--popup-frame))) + (set-frame-size corfu--popup-frame width height t))) (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."