Child frame mispositioned after parent frame resize until next input #612
ArthurHeymans
started this conversation in
Ideas
Replies: 1 comment
-
|
I think it would make sense to simply call |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
When using Corfu in the minibuffer and resizing the Emacs frame, the completion popup child frame stays at its old screen position instead of following the minibuffer. It only gets repositioned when I type the next character.
This happens because:
This affects all Emacs backends (GTK, PGTK, Lucid, etc.) since it's fundamental to how Emacs events work.
Proposed Solution
I've been investigating this in Emacs core and implemented a new resize-frame event mechanism, similar to the existing move-frame event. This generates an event immediately when a frame is resized, allowing packages to respond without waiting for redisplay.
The implementation adds:
Branch with the Emacs changes: https://github.com/ArthurHeymans/emacs/tree/feature/resize-frame-event
Suggested Corfu Integration
With this Emacs change, Corfu could hook into resize-frame-functions to reposition the popup immediately:
(defun corfu--handle-resize-frame (frame)
"Reposition Corfu popup when FRAME is resized."
(when (and corfu--frame
(frame-live-p corfu--frame)
(eq frame (frame-parent corfu--frame)))
(corfu--exhibit)))
;; In corfu--setup:
(add-hook 'resize-frame-functions #'corfu--handle-resize-frame)
;; In corfu--teardown:
(remove-hook 'resize-frame-functions #'corfu--handle-resize-frame)
Do you think this is the right approach to fix this issue? Any feedback on the approach would be appreciated before I pursue getting this into Emacs upstream.
Beta Was this translation helpful? Give feedback.
All reactions