Skip to content

preserve files order in search #31

Description

@basiliscos

There files (sorted) :

$ ls -1 core
buffer.lua
filteredlist.lua
indicator.lua
init.lua
list.lua
style.lua
ui.lua

when I type lua, I'd like to have all that files, keeping the original.

With the proposed patch:

diff --git a/util/matcher.lua b/util/matcher.lua
index ddb2fbf..ebcd36b 100644
--- a/util/matcher.lua
+++ b/util/matcher.lua
@@ -161,6 +161,17 @@ end
 -- @return A table of matcher functions, each taking a line as parameter and
 -- returning a score (or nil for no match).
 function M:_matchers_for_search(search_string)
+  print(search_string);
+  return {
+    function(line)
+      local start_pos, end_pos = string.find(line, search_string, 1, true)
+      if start_pos then
+        return 1, start_pos, end_pos, search_string
+      end
+    end
+  }
+
+--[[
   local fuzzy = self.search_fuzzy
   local fuzzy_penalty = self.fuzzy_score_penalty
   local groups = {}
@@ -184,6 +195,7 @@ function M:_matchers_for_search(search_string)
     end
   end
   return matchers
+]]
 end

I can achive the same.

The default behaviour is a bit crazy: it sorts files by filename length.

ui.lua
list.lua
init.lua
style.lua
buffer.lua
indicator.lua
filteredlist.lua

it's very confusing. I'm also not sure how the current patch can be integrated...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions