diff options
| author | Simon Hauser <Simon-Hauser@outlook.de> | 2021-08-21 20:53:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-21 20:53:09 +0200 |
| commit | e46ef8ffec1637d17dc3f91ade54af3258d5284e (patch) | |
| tree | 6cc1ba2908b7b40f6c6ffee5427a01d1721a586c /lua/telescope/sorters.lua | |
| parent | 1c276f5539786fa96a6da8ed0c199dfb980e9a21 (diff) | |
fix: for default sorters so we dont sort data after ordinal len if #prompt == 0 (#1146)
Diffstat (limited to 'lua/telescope/sorters.lua')
| -rw-r--r-- | lua/telescope/sorters.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lua/telescope/sorters.lua b/lua/telescope/sorters.lua index c3c584c..4ad101e 100644 --- a/lua/telescope/sorters.lua +++ b/lua/telescope/sorters.lua @@ -244,7 +244,7 @@ sorters.get_fuzzy_file = function(opts) if N == 0 or N < ngram_len then -- TODO: If the character is in the line, -- then it should get a point or somethin. - return 0 + return 1 end local prompt_lower = prompt:lower() @@ -352,7 +352,7 @@ sorters.get_generic_fuzzy_sorter = function(opts) -- entry (the whole entry) scoring_function = function(_, prompt, line, _) if prompt == 0 or #prompt < ngram_len then - return 0 + return 1 end local prompt_lower = prompt:lower() @@ -484,7 +484,7 @@ sorters.highlighter_only = function(opts) return Sorter:new { scoring_function = function() - return 0 + return 1 end, highlighter = function(_, prompt, display) @@ -496,7 +496,7 @@ end sorters.empty = function() return Sorter:new { scoring_function = function() - return 0 + return 1 end, } end @@ -531,6 +531,10 @@ sorters.get_substr_matcher = function() return Sorter:new { highlighter = substr_highlighter, scoring_function = function(_, prompt, _, entry) + if #prompt == 0 then + return 1 + end + local display = entry.ordinal:lower() local search_terms = util.max_split(prompt, "%s") |
