Skip to content

Commit

Permalink
Updated prefiltering to limit prefix to avoid penalty for long `s.*s.…
Browse files Browse the repository at this point in the history
…*s...` (#31).
  • Loading branch information
pkulchenko committed Jul 22, 2015
1 parent 6211865 commit cdc464b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/editor/commandbar.lua
Expand Up @@ -319,7 +319,8 @@ function CommandBarScoreItems(t, pattern, limit)
-- anchor for 1-2 symbol patterns to speed up search
local needanchor = prefilter and prefilter * 4 <= #t and plen <= 2
local filter = prefilter and prefilter <= #t
and pattern:gsub("[^%w_]+",""):lower():gsub(".", "%1.*"):gsub("%.%*$","")
-- expand `abc` into `a.*b.*c`, but limit the prefix to avoid penalty for `s.*s.*s.*....`
and pattern:gsub("[^%w_]+",""):sub(1,4):lower():gsub(".", "%1.*"):gsub("%.%*$","")
or nil
for _, v in ipairs(t) do
if #v >= plen then
Expand Down

0 comments on commit cdc464b

Please sign in to comment.