branch: elpa/helm commit 96fc4587aa73757f56550b9def7499fcb5b1a51f Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Fix fuzzy matching score Unknown candidates from helm-mode should always go on top. --- helm-core.el | 5 ++++- helm-mode.el | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helm-core.el b/helm-core.el index acd4b56738..b536f2fd05 100644 --- a/helm-core.el +++ b/helm-core.el @@ -4325,7 +4325,10 @@ This function is used with sources built with `helm-source-sync'." (defvar helm-fuzzy-default-score-fn #'helm-fuzzy-flex-style-score) (defun helm-score-candidate-for-pattern (candidate pattern) "Assign score to CANDIDATE according to PATTERN." - (funcall helm-fuzzy-default-score-fn candidate pattern)) + ;; Unknown candidates always go on top. + (if (equal (get-text-property 0 'display candidate) "[?]") + 200.00 + (funcall helm-fuzzy-default-score-fn candidate pattern))) ;; The flex scoring needs a regexp whereas the fuzzy scoring works ;; directly with helm-pattern, so cache the needed regexp for flex diff --git a/helm-mode.el b/helm-mode.el index bcb4f2ad63..eb717d98de 100644 --- a/helm-mode.el +++ b/helm-mode.el @@ -515,7 +515,9 @@ If COLLECTION is an `obarray', a TEST should be needed. See `obarray'." ;; Unquote helm-pattern when it is added as candidate ;; (Bug#2015). (let ((pat (replace-regexp-in-string "\\s\\" "" helm-pattern))) - (if (or (string= pat "") (helm-cr--pattern-in-candidates-p lst pat)) + (if (or (string= pat "") + (eq must-match t) + (helm-cr--pattern-in-candidates-p lst pat)) lst (append (list (cons (concat (propertize " " 'display