Function: corfu--insert

corfu--insert is a byte-compiled function defined in corfu.el.

Signature

(corfu--insert STATUS)

Documentation

Insert current candidate, exit with STATUS if non-nil.

Implementations

(corfu--insert STATUS) in `corfu.el'.

Undocumented

Source Code

;; Defined in /nix/store/za087xxa0z5mirfbbagrp0qfaqnfn5wb-emacs-packages-deps/share/emacs/site-lisp/elpa/corfu-20260913.1527/corfu.el
(cl-defgeneric corfu--insert (status)
  "Insert current candidate, exit with STATUS if non-nil."
  ;; There is a small bug here, depending on interpretation.  When completing
  ;; "~/emacs/master/li|/calc" where "|" is the cursor, then the candidate only
  ;; includes the prefix "~/emacs/master/lisp/", but not the suffix
  ;; "/calc". Default completion has the same problem when selecting in the
  ;; *Completions* buffer. See bug#48356.
  (pcase-let* ((`(,beg ,end . ,_) completion-in-region--data)
               (str (concat corfu--base (nth corfu--index corfu--candidates))))
    (corfu--replace beg end str)
    (corfu--goto -1) ;; Reset selection, completion may continue.
    (when status (corfu--done str status nil))
    str))