Skip to content

Commit

Permalink
fix: deal with the pattern when score is -1 (#193)
Browse files Browse the repository at this point in the history
* fix: deal with the pattern when score is -1

* docs: fix the default value in README
  • Loading branch information
delphinus committed Apr 29, 2024
1 parent 42b6421 commit 62534e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,9 @@ See [default configuration](https://github.com/nvim-telescope/telescope.nvim#tel
---@param fzy_score number
---@return number
scoring_function = function(recency, fzy_score)
return (10 / (recency == 0 and 1 or recency)) - 1 / fzy_score
local score = (10 / (recency == 0 and 1 or recency)) - 1 / fzy_score
-- HACK: -1 means FILTERED, so return a bit smaller one.
return score == -1 and -1.000001 or score
end,
```

Expand Down
4 changes: 3 additions & 1 deletion lua/frecency/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ Config.new = function()
---@param fzy_score number
---@return number
scoring_function = function(recency, fzy_score)
return (10 / (recency == 0 and 1 or recency)) - 1 / fzy_score
local score = (10 / (recency == 0 and 1 or recency)) - 1 / fzy_score
-- HACK: -1 means FILTERED, so return a bit smaller one.
return score == -1 and -1.000001 or score
end,
show_filter_column = true,
show_scores = false,
Expand Down

0 comments on commit 62534e2

Please sign in to comment.