Fixed previous commit and made condition comments more descriptive
This commit is contained in:
parent
23a07957bc
commit
b298e28bd9
1 changed files with 22 additions and 10 deletions
|
@ -189,23 +189,35 @@
|
||||||
;; We should not throw an error here, as Emacs will disable
|
;; We should not throw an error here, as Emacs will disable
|
||||||
;; the hook if it fails with an error.
|
;; the hook if it fails with an error.
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
;; This condition look similar to one in the post-command hook but it does
|
|
||||||
;; differ significantly -- this one is in part reversed and less strict.
|
|
||||||
(let* ((is-insert-command
|
(let* ((is-insert-command
|
||||||
(corfu--match-symbol-p corfu-auto-commands this-command))
|
(corfu--match-symbol-p corfu-auto-commands this-command))
|
||||||
(is-delete-command
|
(is-delete-command
|
||||||
(corfu--match-symbol-p corfu-overlay-auto-commands this-command)))
|
(corfu--match-symbol-p corfu-overlay-auto-commands this-command)))
|
||||||
|
;; first we check the short-circuit conditions
|
||||||
|
;; to exit as early as possible, so when we know the overlay
|
||||||
|
;; would not be present -- we don't check anything else.
|
||||||
(when (and
|
(when (and
|
||||||
;; we are not in minibuffer.
|
;; we are not in minibuffer; as we don't show overlay
|
||||||
|
;; in the minibuffer so we don't need to hide it.
|
||||||
(not (minibuffer-window-active-p (selected-window)))
|
(not (minibuffer-window-active-p (selected-window)))
|
||||||
;; corfu menu shown
|
|
||||||
(or (not corfu--frame)
|
|
||||||
(and (frame-live-p corfu--frame) (frame-visible-p corfu--frame)))
|
|
||||||
(not corfu-auto) ;; don't work with corfu-auto
|
(not corfu-auto) ;; don't work with corfu-auto
|
||||||
;; and the command is not one of insert or delete.
|
;; short-circuit conditions are done, now real conditions
|
||||||
(not (or
|
;; that hide the overlay -- only one of those need to be met.
|
||||||
is-insert-command
|
(or
|
||||||
is-delete-command)))
|
;; corfu menu is/was shown so we have to hide our own overlay.
|
||||||
|
(or
|
||||||
|
(and corfu--frame ;; corfu menu not present,
|
||||||
|
;; so no need to check for it.
|
||||||
|
(frame-live-p corfu--frame)
|
||||||
|
(frame-visible-p corfu--frame)))
|
||||||
|
;; the command is not one of insert or delete,
|
||||||
|
;; so we should hide the overlay as any movement.
|
||||||
|
;; Reason is the command will „see” the point at the end of
|
||||||
|
;; the overlay so cross-row movement will be off by the
|
||||||
|
;; overlay's lenght.
|
||||||
|
(not (or
|
||||||
|
is-insert-command
|
||||||
|
is-delete-command))))
|
||||||
(corfu-hide-candidate-overlay)))))
|
(corfu-hide-candidate-overlay)))))
|
||||||
|
|
||||||
(defun corfu--candidate-overlay-post-command ()
|
(defun corfu--candidate-overlay-post-command ()
|
||||||
|
|
Loading…
Reference in a new issue