summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-01-02 18:31:32 +0100
committerBram Moolenaar <Bram@vim.org>2021-01-02 18:31:32 +0100
commit9d19e4f4ba55f8bef18d4991abdf740ff6472dba (patch)
treec5bd4e0ba05fb3089d3acedee4e32729b2f5c3a4 /runtime
parent508b5618ec0bc6d1edff71e04d99280a2a51df9d (diff)
patch 8.2.2280: fuzzy matching doesn't give access to the scoresv8.2.2280
Problem: Fuzzy matching doesn't give access to the scores. Solution: Return the scores with a third list. (Yegappan Lakshmanan, closes #7596)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt16
1 files changed, 8 insertions, 8 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 3043225413..750448dfc6 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -7471,24 +7471,24 @@ matchfuzzy({list}, {str} [, {dict}]) *matchfuzzy()*
matchfuzzypos({list}, {str} [, {dict}]) *matchfuzzypos()*
Same as |matchfuzzy()|, but returns the list of matched
- strings and the list of character positions where characters
- in {str} matches. You can use |byteidx()|to convert a
- character position to a byte position.
-
+ strings, the list of character positions where characters
+ in {str} matches and a list of matching scores. You can
+ use |byteidx()|to convert a character position to a byte
+ position.
If {str} matches multiple times in a string, then only the
positions for the best match is returned.
If there are no matching strings or there is an error, then a
- list with two empty list items is returned.
+ list with three empty list items is returned.
Example: >
:echo matchfuzzypos(['testing'], 'tsg')
-< results in [['testing'], [[0, 2, 6]]] >
+< results in [['testing'], [[0, 2, 6]], [99]] >
:echo matchfuzzypos(['clay', 'lacy'], 'la')
-< results in [['lacy', 'clay'], [[0, 1], [1, 2]]] >
+< results in [['lacy', 'clay'], [[0, 1], [1, 2]], [153, 133]] >
:echo [{'text': 'hello', 'id' : 10}]->matchfuzzypos('ll', {'key' : 'text'})
-< results in [{'id': 10, 'text': 'hello'}] [[2, 3]]
+< results in [[{'id': 10, 'text': 'hello'}], [[2, 3]], [127]]
matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()*
Same as |match()|, but return a |List|. The first item in the