fix: Don't push past midnight. You'll make clason's stuff break :/

This commit is contained in:
TJ DeVries
2020-09-04 09:49:10 -04:00
parent 996f69465e
commit 14310ee6b1
9 changed files with 352 additions and 223 deletions

View File

@@ -26,7 +26,7 @@ end
function Sorter:score(prompt, entry)
-- TODO: Decide if we actually want to check the type every time.
return self:scoring_function(prompt, type(entry) == "string" and entry or entry.ordinal)
return self:scoring_function(prompt, type(entry) == "string" and entry or entry.ordinal, entry)
end
function sorters.new(...)
@@ -232,7 +232,11 @@ sorters.get_norcalli_sorter = function()
end
return Sorter:new {
scoring_function = function(_, prompt, line)
-- self
-- prompt (which is the text on the line)
-- line (entry.ordinal)
-- entry (the whole entry)
scoring_function = function(_, prompt, line, _)
if prompt == 0 or #prompt < ngramlen then
return 0
end