diff options
| author | Yuwei Tian <fishtai0@gmail.com> | 2022-06-08 23:05:20 +0800 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2022-11-17 20:39:49 +0100 |
| commit | abe4a14d520c9545f82c38c65ab17fbaca84591f (patch) | |
| tree | 660784078bfe05635ef02e1578c196ac7776be48 /corfu.el | |
| parent | 0632308f33e5d142d21ec75559412ebecc5316b0 (diff) | |
Add optional argument to hack redisplay when move the frame
Diffstat (limited to 'corfu.el')
| -rw-r--r-- | corfu.el | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -391,10 +391,14 @@ The completion backend can override this with ;; Function adapted from posframe.el by tumashu (defvar x-gtk-resize-child-frames) ;; Not present on non-gtk builds -(defun corfu--make-frame (frame params buffer x y width height) +(defun corfu--make-frame (frame params buffer x y width height + &optional hack-redisplay-p) "Make child frame from BUFFER and show it at X/Y with WIDTH/HEIGHT. -PARAMS are frame parameters and FRAME is the existing frame." +PARAMS are frame parameters and FRAME is the existing frame. + +If the optional argument HACK-REDISPLAY-P is non-nil, +hack redisplay to avoid flicker." (when corfu--frame-timer (cancel-timer corfu--frame-timer) (setq corfu--frame-timer nil)) @@ -450,8 +454,9 @@ PARAMS are frame parameters and FRAME is the existing frame." ;; XXX HACK Avoid flicker when frame is already visible. ;; Redisplay, wait for resize and then move the frame. (unless (equal (frame-position frame) (cons x y)) - (redisplay 'force) - (sleep-for 0.01) + (when hack-redisplay-p + (redisplay 'force) + (sleep-for 0.01)) (set-frame-position frame x y)) ;; XXX HACK: Force redisplay, otherwise the popup sometimes does not ;; display content. @@ -504,7 +509,8 @@ A scroll bar is displayed from LO to LO+BAR." lines "\n")))) (setq corfu--frame (corfu--make-frame corfu--frame corfu--frame-parameters buffer - x y width height)))) + x y width height + 'hack-redisplay)))) (defun corfu--hide-frame-deferred () "Deferred frame hiding." |
