Function: consult--async-options

consult--async-options is a byte-compiled function defined in consult.el.

Signature

(consult--async-options)

Documentation

Async function, which highlights commands options in the input string.

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
(defun consult--async-options ()
  "Async function, which highlights commands options in the input string."
  (lambda (sink)
    (lambda (action)
      (when (stringp action)
        (save-match-data
          (when-let* ((iend (save-excursion
                              (goto-char (minibuffer-prompt-end))
                              (search-forward action nil t)))
                      (ibeg (- iend (length action))))
            (remove-list-of-text-properties ibeg iend '(face rear-nonsticky))
            (when-let* (((string-match "\\(?:\\`\\| \\)\\(-\\)" action))
                        (beg (match-beginning 1))
                        ((string-match "\\(?:\\`\\| \\)\\(--\\)\\(?: \\|\\'\\)\\|\\'" action))
                        (end (or (match-end 1) (match-end 0))))
              (add-text-properties (+ ibeg beg) (+ ibeg end)
                                   '( face consult-async-option
                                      rear-nonsticky t))))))
      (funcall sink action))))