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

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

[elpa] externals/corfu a97fca9 5/6: child frame: Anti-flicker fix


From: Protesilaos Stavrou
Subject: [elpa] externals/corfu a97fca9 5/6: child frame: Anti-flicker fix
Date: Thu, 29 Apr 2021 13:38:53 -0400 (EDT)

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

    child frame: Anti-flicker fix
---
 corfu.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/corfu.el b/corfu.el
index b6c3688..0780f71 100644
--- a/corfu.el
+++ b/corfu.el
@@ -183,10 +183,10 @@ Set to nil in order to disable confirmation."
          (edge (window-inside-pixel-edges))
          (lh (line-pixel-height))
          (x (max 0 (min (+ (car edge) x -1) (- (frame-pixel-width) width))))
-         (y (+ (cadr edge) y))
-        (y (if (> (+ y height (* 3 lh)) (frame-pixel-height))
-               (- y height 1)
-              (+ y lh)))
+         (yb (+ (cadr edge) y lh))
+        (y (if (> (+ yb height lh lh) (frame-pixel-height))
+               (- yb height lh 1)
+              yb))
          (buffer (get-buffer-create " *corfu*")))
     (with-current-buffer buffer
       (setq-local mode-line-format nil
@@ -238,8 +238,12 @@ Set to nil in order to disable confirmation."
     (set-face-background 'internal-border (face-attribute 'corfu-border 
:background) corfu--frame)
     (set-frame-parameter corfu--frame 'background-color (face-attribute 
'corfu-background :background))
     (set-window-buffer (frame-root-window corfu--frame) buffer)
-    (set-frame-position corfu--frame x y)
+    ;; XXX Make the frame invisible before moving the popup from above to below
+    ;; the line in order to avoid flicker.
+    (unless (eq (< (cdr (frame-position corfu--frame)) yb) (< y yb))
+      (make-frame-invisible corfu--frame))
     (set-frame-size corfu--frame width height t)
+    (set-frame-position corfu--frame x y)
     (make-frame-visible corfu--frame)))
 
 (defun corfu--popup-show (pos lines &optional curr lo bar)



reply via email to

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