Function: eca-completion--set-overlay-text

eca-completion--set-overlay-text is a natively compiled function defined in eca-completion.el.

Signature

(eca-completion--set-overlay-text OV TEXT)

Documentation

Set overlay OV with TEXT.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-completion.el
(defun eca-completion--set-overlay-text (ov text)
  "Set overlay OV with TEXT."
  (move-overlay ov (point) (line-end-position))
  (move-overlay (overlay-get ov 'keymap-overlay) (point) (min (point-max) (+ 1 (point))))

  (let* ((display-text (eca-completion--prepare-display-text text))
         (tail (buffer-substring (- (line-end-position) (overlay-get ov 'tail-length)) (line-end-position)))
         (text-p (concat display-text tail)))
    ;; Layer the overlay face with APPEND priority so any font-lock
    ;; foregrounds set during fontification remain visible.  Apply only
    ;; to the suggestion portion; the trailing buffer text keeps its
    ;; own faces untouched.
    (add-face-text-property 0 (length display-text)
                            'eca-completion-overlay-face t text-p)
    (if (eolp)
        (progn
          (overlay-put ov 'after-string "")
          (setq eca-completion--real-posn (cons (point) (posn-at-point)))
          (put-text-property 0 1 'cursor t text-p)
          (overlay-put ov 'display "")
          (overlay-put ov 'after-string text-p))
      (overlay-put ov 'display (substring text-p 0 1))
      (overlay-put ov 'after-string (substring text-p 1)))
    (overlay-put ov 'completion text)
    (overlay-put ov 'start (point))))