From 62534e2479c860a978552fcfb36fe51e1d7afb68 Mon Sep 17 00:00:00 2001 From: JINNOUCHI Yasushi Date: Mon, 29 Apr 2024 12:53:44 +0900 Subject: [PATCH] fix: deal with the pattern when score is -1 (#193) * fix: deal with the pattern when score is -1 * docs: fix the default value in README --- README.md | 4 +++- lua/frecency/config.lua | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a94bd49..5f4d40c 100644 --- a/README.md +++ b/README.md @@ -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, ``` diff --git a/lua/frecency/config.lua b/lua/frecency/config.lua index eb2d3f4..d72ba81 100644 --- a/lua/frecency/config.lua +++ b/lua/frecency/config.lua @@ -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,