File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 5050 " Check if a string IN-STR contain in any string in the string list IN-LIST."
5151 (cl-some #' (lambda (lb-sub-str ) (string-match-p (regexp-quote lb-sub-str) in-str)) in-list))
5252
53+
54+ (defun helm-fuzzy--find-pattern ()
55+ " Get the raw pattern directly from minibuffer."
56+ (let ((pattern " " )
57+ (pos -1 ))
58+ (when (active-minibuffer-window )
59+ (select-window (active-minibuffer-window ))
60+ (setq pattern (buffer-string ))
61+ (setq pos (string-match-p helm-pattern pattern))
62+ (setq pattern (substring pattern pos (length pattern))))
63+ pattern))
64+
5365(defun helm-fuzzy--sort-candidates (candidates )
5466 " Fuzzy matching for all CANDIDATES."
5567 (when (and (not (string= helm-pattern " " ))
5668 (not (helm-fuzzy--is-contain-list-string helm-fuzzy-not-allow-fuzzy helm-buffer)))
5769 (require 'flx )
5870 (let* ((scoring-table (make-hash-table ))
5971 (scoring-keys '())
60- (first-sel (nth 0 candidates))
61- (pattern (if (listp first-sel) (cdr first-sel) first-sel)))
72+ (pattern (helm-fuzzy--find-pattern)))
6273 (dolist (cand candidates)
6374 (let* ((cand-id (if (listp cand) (cdr cand) cand))
6475 (scoring (flx-score cand-id pattern))
90101 (setq candidates (helm-fuzzy--sort-candidates candidates))
91102 candidates))
92103
104+
93105(defun helm-fuzzy--enable ()
94106 " Enable `helm-fuzzy' ."
95107 (require 'helm )
You can’t perform that action at this time.
0 commit comments