Function: consult--split-perl

consult--split-perl is a byte-compiled function defined in consult.el.

Signature

(consult--split-perl STR &optional PLIST)

Documentation

Split input STR in async input and filtering part.

The function returns a list with three elements: The async string, the start position of the completion filter string and a force flag. If the first character is a punctuation character it determines the separator. Examples: "/async/filter",
"#async#filter".

Source Code

;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;; Splitting completion style

(defun consult--split-perl (str &optional _plist)
  "Split input STR in async input and filtering part.

The function returns a list with three elements: The async
string, the start position of the completion filter string and a
force flag.  If the first character is a punctuation character it
determines the separator.  Examples: \"/async/filter\",
\"#async#filter\"."
  (if (string-match-p "^[[:punct:]]" str)
      (save-match-data
        (let ((q (regexp-quote (substring str 0 1))))
          (string-match (concat "^" q "\\([^" q "]*\\)\\(" q "\\)?") str)
          ;; Force update if two punctuation characters are entered.
          `(,(propertize (match-string 1 str) 'consult--force (match-end 2))
            ,(match-end 0)
            ;; List of highlights
            (0 . ,(match-beginning 1))
            ,@(and (match-end 2) `((,(match-beginning 2) . ,(match-end 2)))))))
    `(,str ,(length str))))