Closed allenryb closed 3 years ago
This may be realted with https://github.com/tumashu/ivy-posframe/issues/21
If I load the following code by @kongds, then ivy-posframe-avy
works fine.
(defvar ivy-posframe--first-show t)
(defun ivy-posframe-cleanup ()
"Cleanup ivy's posframe."
(setq ivy-posframe--first-show t)
(when (posframe-workable-p)
(posframe-hide ivy-posframe-buffer)))
(defun ivy-posframe--display (str &optional poshandler)
"Show STR in ivy's posframe with POSHANDLER."
(if (not (posframe-workable-p))
(ivy-display-function-fallback str)
(with-ivy-window
(if (not ivy-posframe--first-show)
(with-current-buffer ivy-posframe-buffer
(erase-buffer)
(insert str))
(setq ivy-posframe--first-show nil)
(apply #'posframe-show
ivy-posframe-buffer
:font ivy-posframe-font
:string str
:position (point)
:poshandler poshandler
:background-color (face-attribute 'ivy-posframe :background nil t)
:foreground-color (face-attribute 'ivy-posframe :foreground nil t)
:internal-border-width ivy-posframe-border-width
:internal-border-color (face-attribute 'ivy-posframe-border :background nil t)
:override-parameters ivy-posframe-parameters
(funcall ivy-posframe-size-function)))
(ivy-posframe--add-prompt 'ignore)))
(with-current-buffer ivy-posframe-buffer
(setq-local truncate-lines ivy-truncate-lines)))
By comparing with the original code of ivy-posframe--display
and the above, the :hidehandler #'ivy-posframe-hidehandler
with ivy-posframe-avy
may cause this problem.
The buffers may change at the step with-selected-window (ivy-posframe--window)
.
I use the following code to check the buffers at this step.
(defun ivy-posframe-avy ()
"Ivy-posframe's `ivy-avy'."
(interactive)
(let ((avy-pre-action #'ignore))
(message "buffer-name-outside is %s" (buffer-name)) ;; Line 1
(with-selected-window (ivy-posframe--window)
(message "buffer-name-inside is %s" (buffer-name)) ;; Line 2
(ivy-avy))))
And the message
results are
buffer-name-outside is *Minibuf-1* ;; Line 1
buffer-name-inside is *ivy-posframe-buffer* ;; Line 2
which give the different returns of ivy-posframe-hidehandler
.
Should be fixed, please test again
The problem has been fixed. Thanks!
When I use
ivy-posframe-avy
(pressingC-'
) inM-x
, the avy feature works but disappears in a flash. That is, theavy-keys
asdfg...
appears at the left of candidates but theivy-posframe
frame will disappear in a second.Another problem is for
ivy-posframe-swiper-avy
. It shows theavy-keys
in the normal buffer frame, not in theivy-posframe
frame.